From 7b6c5f0a9d02785bee3e4c2585fea1f8983e61b0 Mon Sep 17 00:00:00 2001 From: Egor Kislitsyn Date: Tue, 8 Jan 2019 16:01:35 +0700 Subject: [PATCH] improve test readability --- test/web/activity_pub/activity_pub_test.exs | 6 +++--- test/web/common_api/common_api_test.exs | 2 +- test/web/mastodon_api/mastodon_api_controller_test.exs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/web/activity_pub/activity_pub_test.exs b/test/web/activity_pub/activity_pub_test.exs index 325ef6636..e6c998876 100644 --- a/test/web/activity_pub/activity_pub_test.exs +++ b/test/web/activity_pub/activity_pub_test.exs @@ -610,14 +610,14 @@ test "returned pinned statuses" do {:ok, activity_three} = CommonAPI.post(user, %{"status" => "HI!!!"}) CommonAPI.pin(activity_one.id, user) + user = refresh_record(user) - user = User.get_by_ap_id(user.ap_id) CommonAPI.pin(activity_two.id, user) + user = refresh_record(user) - user = User.get_by_ap_id(user.ap_id) CommonAPI.pin(activity_three.id, user) + user = refresh_record(user) - user = User.get_by_ap_id(user.ap_id) activities = ActivityPub.fetch_user_activities(user, nil, %{"pinned" => "true"}) assert 3 = length(activities) diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs index 24e5e56f4..7d5ceb398 100644 --- a/test/web/common_api/common_api_test.exs +++ b/test/web/common_api/common_api_test.exs @@ -116,7 +116,7 @@ test "max pinned statuses" do assert {:ok, ^activity_one} = CommonAPI.pin(activity_one.id, user) - user = User.get_by_ap_id(user.ap_id) + user = refresh_record(user) assert {:error, "You have already pinned the maximum number of statuses"} = CommonAPI.pin(activity_two.id, user) diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs index 4a8c70b3b..a3c58379e 100644 --- a/test/web/mastodon_api/mastodon_api_controller_test.exs +++ b/test/web/mastodon_api/mastodon_api_controller_test.exs @@ -1522,7 +1522,7 @@ test "unpin status", %{conn: conn} do {:ok, _} = CommonAPI.pin(activity.id, user) id_str = Integer.to_string(activity.id) - user = User.get_by_ap_id(user.ap_id) + user = refresh_record(user) assert %{"id" => ^id_str, "pinned" => false} = conn @@ -1556,7 +1556,7 @@ test "max pinned statuses", %{conn: conn} do |> Map.get(:resp_body) |> Jason.decode!() - user = User.get_by_ap_id(user.ap_id) + user = refresh_record(user) assert %{"error" => "You have already pinned the maximum number of statuses"} = conn