improve test readability
authorEgor Kislitsyn <egor@kislitsyn.com>
Tue, 8 Jan 2019 09:01:35 +0000 (16:01 +0700)
committerEgor Kislitsyn <egor@kislitsyn.com>
Tue, 8 Jan 2019 09:01:35 +0000 (16:01 +0700)
test/web/activity_pub/activity_pub_test.exs
test/web/common_api/common_api_test.exs
test/web/mastodon_api/mastodon_api_controller_test.exs

index 325ef663676560dc5f253ffb2e693df2854ae4d9..e6c998876d96b79d56781e1b2de6ece8217685f6 100644 (file)
@@ -610,14 +610,14 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest 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)
index 24e5e56f4c3785e710c3318b0603c92600d23272..7d5ceb3982c7dad0e4f646156fc952f14dec3d2d 100644 (file)
@@ -116,7 +116,7 @@ defmodule Pleroma.Web.CommonAPI.Test 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)
index 4a8c70b3ba9b2c98abef2d7a3688566f20150279..a3c58379e95e4c24062fc030b0e86f1f7871e27f 100644 (file)
@@ -1522,7 +1522,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest 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 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest 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