improve test readability

This commit is contained in:
Egor Kislitsyn 2019-01-08 16:01:35 +07:00
parent db6f4496eb
commit 7b6c5f0a9d
3 changed files with 6 additions and 6 deletions

View File

@ -610,14 +610,14 @@ test "returned pinned statuses" do
{:ok, activity_three} = CommonAPI.post(user, %{"status" => "HI!!!"}) {:ok, activity_three} = CommonAPI.post(user, %{"status" => "HI!!!"})
CommonAPI.pin(activity_one.id, user) 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) 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) 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"}) activities = ActivityPub.fetch_user_activities(user, nil, %{"pinned" => "true"})
assert 3 = length(activities) assert 3 = length(activities)

View File

@ -116,7 +116,7 @@ test "max pinned statuses" do
assert {:ok, ^activity_one} = CommonAPI.pin(activity_one.id, user) 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"} = assert {:error, "You have already pinned the maximum number of statuses"} =
CommonAPI.pin(activity_two.id, user) CommonAPI.pin(activity_two.id, user)

View File

@ -1522,7 +1522,7 @@ test "unpin status", %{conn: conn} do
{:ok, _} = CommonAPI.pin(activity.id, user) {:ok, _} = CommonAPI.pin(activity.id, user)
id_str = Integer.to_string(activity.id) 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} = assert %{"id" => ^id_str, "pinned" => false} =
conn conn
@ -1556,7 +1556,7 @@ test "max pinned statuses", %{conn: conn} do
|> Map.get(:resp_body) |> Map.get(:resp_body)
|> Jason.decode!() |> 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"} = assert %{"error" => "You have already pinned the maximum number of statuses"} =
conn conn