X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=test%2Fweb%2Fmetadata%2Fopengraph_test.exs;h=9d7c009eb274b256b8f902eeac6c914112482ebf;hb=3508f698b9b51a86ccc5014f83f9b6c89ba58b0d;hp=1c4fadc46e474db35aecdcbb5165d4320ac4b993;hpb=64143d8040a5806ccf9707644a7e7eacc91d74c6;p=akkoma
diff --git a/test/web/metadata/opengraph_test.exs b/test/web/metadata/opengraph_test.exs
index 1c4fadc46..9d7c009eb 100644
--- a/test/web/metadata/opengraph_test.exs
+++ b/test/web/metadata/opengraph_test.exs
@@ -1,11 +1,14 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Web.Metadata.Providers.OpenGraphTest do
use Pleroma.DataCase
import Pleroma.Factory
alias Pleroma.Web.Metadata.Providers.OpenGraph
+ clear_config([Pleroma.Web.Metadata, :unfurl_nsfw])
+
test "it renders all supported types of attachments and skips unknown types" do
user = insert(:user)
@@ -47,19 +50,7 @@ defmodule Pleroma.Web.Metadata.Providers.OpenGraphTest do
}
})
- note_activity =
- insert(:note_activity, %{
- data: %{
- "actor" => note.data["actor"],
- "to" => note.data["to"],
- "object" => note.data,
- "context" => note.data["context"]
- },
- actor: note.data["actor"],
- recipients: note.data["to"]
- })
-
- result = OpenGraph.build_tags(%{activity: note_activity, user: user})
+ result = OpenGraph.build_tags(%{object: note, url: note.data["id"], user: user})
assert Enum.all?(
[
@@ -85,6 +76,7 @@ defmodule Pleroma.Web.Metadata.Providers.OpenGraphTest do
"id" => "https://pleroma.gov/objects/whatever",
"content" => "#cuteposting #nsfw #hambaga",
"tag" => ["cuteposting", "nsfw", "hambaga"],
+ "sensitive" => true,
"attachment" => [
%{
"url" => [
@@ -95,19 +87,7 @@ defmodule Pleroma.Web.Metadata.Providers.OpenGraphTest do
}
})
- note_activity =
- insert(:note_activity, %{
- data: %{
- "actor" => note.data["actor"],
- "to" => note.data["to"],
- "object" => note.data,
- "context" => note.data["context"]
- },
- actor: note.data["actor"],
- recipients: note.data["to"]
- })
-
- result = OpenGraph.build_tags(%{activity: note_activity, user: user})
+ result = OpenGraph.build_tags(%{object: note, url: note.data["id"], user: user})
assert {:meta, [property: "og:image", content: "https://pleroma.gov/tenshi.png"], []} in result