diff options
author | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2020-12-28 12:02:16 +0000 |
---|---|---|
committer | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2020-12-28 12:02:16 +0000 |
commit | 3966add048fda791e6893540d8304b0e626ab9f4 (patch) | |
tree | 3a3da119eb71a0536bd5f23226834dfea634d74a /test | |
parent | b122b6ffa318af30586f9da0532135959804a6a0 (diff) | |
download | pleroma-3966add048fda791e6893540d8304b0e626ab9f4.tar.gz pleroma-3966add048fda791e6893540d8304b0e626ab9f4.zip |
Revert "Merge branch 'features/hashtag-column' into 'develop'"
This reverts merge request !2824
Diffstat (limited to 'test')
-rw-r--r-- | test/pleroma/activity/ir/topics_test.exs | 2 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/mrf/simple_policy_test.exs | 6 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs | 4 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/transmogrifier_test.exs | 41 | ||||
-rw-r--r-- | test/pleroma/web/common_api/utils_test.exs | 3 | ||||
-rw-r--r-- | test/pleroma/web/common_api_test.exs | 3 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/views/status_view_test.exs | 4 | ||||
-rw-r--r-- | test/support/factory.ex | 2 |
8 files changed, 28 insertions, 37 deletions
diff --git a/test/pleroma/activity/ir/topics_test.exs b/test/pleroma/activity/ir/topics_test.exs index dd1611bbe..b464822d9 100644 --- a/test/pleroma/activity/ir/topics_test.exs +++ b/test/pleroma/activity/ir/topics_test.exs @@ -78,7 +78,7 @@ defmodule Pleroma.Activity.Ir.TopicsTest do end test "converts tags to hash tags", %{activity: %{object: %{data: data} = object} = activity} do - tagged_data = Map.put(data, "hashtags", ["foo", "bar"]) + tagged_data = Map.put(data, "tag", ["foo", "bar"]) activity = %{activity | object: %{object | data: tagged_data}} topics = Topics.get_activity_topics(activity) diff --git a/test/pleroma/web/activity_pub/mrf/simple_policy_test.exs b/test/pleroma/web/activity_pub/mrf/simple_policy_test.exs index 9777fcde1..d7dde62c4 100644 --- a/test/pleroma/web/activity_pub/mrf/simple_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/simple_policy_test.exs @@ -78,7 +78,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.SimplePolicyTest do assert SimplePolicy.filter(media_message) == {:ok, media_message - |> put_in(["object", "hashtags"], ["foo", "nsfw"]) + |> put_in(["object", "tag"], ["foo", "nsfw"]) |> put_in(["object", "sensitive"], true)} assert SimplePolicy.filter(local_message) == {:ok, local_message} @@ -92,7 +92,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.SimplePolicyTest do assert SimplePolicy.filter(media_message) == {:ok, media_message - |> put_in(["object", "hashtags"], ["foo", "nsfw"]) + |> put_in(["object", "tag"], ["foo", "nsfw"]) |> put_in(["object", "sensitive"], true)} assert SimplePolicy.filter(local_message) == {:ok, local_message} @@ -105,7 +105,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.SimplePolicyTest do "type" => "Create", "object" => %{ "attachment" => [%{}], - "hashtags" => ["foo"], + "tag" => ["foo"], "sensitive" => false } } diff --git a/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs index 528636f04..b4a006aec 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs @@ -39,7 +39,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.NoteHandlingTest do {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data) object = Object.normalize(data["object"]) - assert ["test"] == object.data["hashtags"] + assert "test" in object.data["tag"] end test "it cleans up incoming notices which are not really DMs" do @@ -220,7 +220,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.NoteHandlingTest do {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data) object = Object.normalize(data["object"]) - assert object.data["hashtags"] == ["moo"] + assert Enum.at(object.data["tag"], 2) == "moo" end test "it works for incoming notices with contentMap" do diff --git a/test/pleroma/web/activity_pub/transmogrifier_test.exs b/test/pleroma/web/activity_pub/transmogrifier_test.exs index d0bd00b58..66ea7664a 100644 --- a/test/pleroma/web/activity_pub/transmogrifier_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier_test.exs @@ -204,37 +204,30 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do {:ok, activity} = CommonAPI.post(user, %{status: "#2hu :firefox:"}) - {:ok, %{"object" => modified_object}} = Transmogrifier.prepare_outgoing(activity.data) - - assert [ - %{"name" => "#2hu", "type" => "Hashtag"}, - %{"name" => ":firefox:", "type" => "Emoji"} - ] = modified_object["tag"] - - refute Map.has_key?(modified_object, "hashtags") - refute Map.has_key?(modified_object, "emoji") - refute Map.has_key?(modified_object, "like_count") - refute Map.has_key?(modified_object, "announcements") - refute Map.has_key?(modified_object, "announcement_count") - refute Map.has_key?(modified_object, "context_id") + {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data) + + assert length(modified["object"]["tag"]) == 2 + + assert is_nil(modified["object"]["emoji"]) + assert is_nil(modified["object"]["like_count"]) + assert is_nil(modified["object"]["announcements"]) + assert is_nil(modified["object"]["announcement_count"]) + assert is_nil(modified["object"]["context_id"]) end test "it strips internal fields of article" do activity = insert(:article_activity) - {:ok, %{"object" => modified_object}} = Transmogrifier.prepare_outgoing(activity.data) + {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data) - assert [ - %{"name" => "#2hu", "type" => "Hashtag"}, - %{"name" => ":2hu:", "type" => "Emoji"} - ] = modified_object["tag"] + assert length(modified["object"]["tag"]) == 2 - refute Map.has_key?(modified_object, "hashtags") - refute Map.has_key?(modified_object, "emoji") - refute Map.has_key?(modified_object, "like_count") - refute Map.has_key?(modified_object, "announcements") - refute Map.has_key?(modified_object, "announcement_count") - refute Map.has_key?(modified_object, "context_id") + assert is_nil(modified["object"]["emoji"]) + assert is_nil(modified["object"]["like_count"]) + assert is_nil(modified["object"]["announcements"]) + assert is_nil(modified["object"]["announcement_count"]) + assert is_nil(modified["object"]["context_id"]) + assert is_nil(modified["object"]["likes"]) end test "the directMessage flag is present" do diff --git a/test/pleroma/web/common_api/utils_test.exs b/test/pleroma/web/common_api/utils_test.exs index 211042192..4d6c9ea26 100644 --- a/test/pleroma/web/common_api/utils_test.exs +++ b/test/pleroma/web/common_api/utils_test.exs @@ -591,8 +591,7 @@ defmodule Pleroma.Web.CommonAPI.UtilsTest do "context" => "2hu", "sensitive" => false, "summary" => "test summary", - "hashtags" => ["jimm"], - "tag" => [], + "tag" => ["jimm"], "to" => [user2.ap_id], "type" => "Note", "custom_tag" => "test" diff --git a/test/pleroma/web/common_api_test.exs b/test/pleroma/web/common_api_test.exs index 3b7ac2033..585b2c174 100644 --- a/test/pleroma/web/common_api_test.exs +++ b/test/pleroma/web/common_api_test.exs @@ -493,8 +493,7 @@ defmodule Pleroma.Web.CommonAPITest do object = Object.normalize(activity) - assert object.data["tag"] == [] - assert object.data["hashtags"] == ["2hu"] + assert object.data["tag"] == ["2hu"] end test "it adds emoji in the object" do diff --git a/test/pleroma/web/mastodon_api/views/status_view_test.exs b/test/pleroma/web/mastodon_api/views/status_view_test.exs index d4378ccbc..fa9066716 100644 --- a/test/pleroma/web/mastodon_api/views/status_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/status_view_test.exs @@ -262,8 +262,8 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do mentions: [], tags: [ %{ - name: "2hu", - url: "/tag/2hu" + name: "#{object_data["tag"]}", + url: "/tag/#{object_data["tag"]}" } ], application: %{ diff --git a/test/support/factory.ex b/test/support/factory.ex index a709d0dae..8eb07dc3c 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -93,7 +93,7 @@ defmodule Pleroma.Factory do "like_count" => 0, "context" => "2hu", "summary" => "2hu", - "hashtags" => ["2hu"], + "tag" => ["2hu"], "emoji" => %{ "2hu" => "corndog.png" } |