TimelineControllerTest: Fix hashtag timeline test

This commit is contained in:
lain 2020-01-15 13:04:39 +01:00
parent b9b668d39e
commit c8da684434

View File

@ -270,20 +270,29 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do
any_test = get(conn, "/api/v1/timelines/tag/test", %{"any" => ["test1"]})
[status_none, status_test1, status_test] = json_response(any_test, :ok)
results = json_response(any_test, :ok)
assert to_string(activity_test.id) == status_test["id"]
assert to_string(activity_test1.id) == status_test1["id"]
assert to_string(activity_none.id) == status_none["id"]
# This should be reactivated when the timeline is sorted again
# assert to_string(activity_test.id) == status_test["id"]
# assert to_string(activity_test1.id) == status_test1["id"]
# assert to_string(activity_none.id) == status_none["id"]
ids = Enum.map(results, & &1["id"])
assert activity_test.id in ids
assert activity_test1.id in ids
assert activity_none.id in ids
restricted_test =
get(conn, "/api/v1/timelines/tag/test", %{"all" => ["test1"], "none" => ["none"]})
assert [status_test1] == json_response(restricted_test, :ok)
[status_test1] = json_response(restricted_test, :ok)
assert status_test1["id"] == activity_test1.id
all_test = get(conn, "/api/v1/timelines/tag/test", %{"all" => ["none"]})
all_test = get(conn, "/api/v1/timelines/tag/test", %{"all" => ["test", "none"]})
assert [status_none] == json_response(all_test, :ok)
[status_none] = json_response(all_test, :ok)
assert status_none["id"] == activity_none.id
end
end
end