X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=test%2Ftasks%2Fdatabase_test.exs;h=883828d7731cb132268edf2d0128f471a6762f8f;hb=87180ff817e4b9e3a3b90e7f0054b60b0d0c2c41;hp=b63dcac002e5cfce7c045e5cd64231f5dce3f594;hpb=b923842e96e821afeb7bbfa0d098b9c5698281c5;p=akkoma
diff --git a/test/tasks/database_test.exs b/test/tasks/database_test.exs
index b63dcac00..883828d77 100644
--- a/test/tasks/database_test.exs
+++ b/test/tasks/database_test.exs
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Mix.Tasks.Pleroma.DatabaseTest do
@@ -26,7 +26,7 @@ defmodule Mix.Tasks.Pleroma.DatabaseTest do
describe "running remove_embedded_objects" do
test "it replaces objects with references" do
user = insert(:user)
- {:ok, activity} = CommonAPI.post(user, %{"status" => "test"})
+ {:ok, activity} = CommonAPI.post(user, %{status: "test"})
new_data = Map.put(activity.data, "object", activity.object.data)
{:ok, activity} =
@@ -72,26 +72,26 @@ defmodule Mix.Tasks.Pleroma.DatabaseTest do
describe "running update_users_following_followers_counts" do
test "following and followers count are updated" do
[user, user2] = insert_pair(:user)
- {:ok, %User{following: following, info: info} = user} = User.follow(user, user2)
+ {:ok, %User{} = user} = User.follow(user, user2)
+
+ following = User.following(user)
assert length(following) == 2
- assert info.follower_count == 0
+ assert user.follower_count == 0
{:ok, user} =
user
- |> Ecto.Changeset.change(%{following: following ++ following})
- |> User.change_info(&Ecto.Changeset.change(&1, %{follower_count: 3}))
+ |> Ecto.Changeset.change(%{follower_count: 3})
|> Repo.update()
- assert length(user.following) == 4
- assert user.info.follower_count == 3
+ assert user.follower_count == 3
assert :ok == Mix.Tasks.Pleroma.Database.run(["update_users_following_followers_counts"])
user = User.get_by_id(user.id)
- assert length(user.following) == 2
- assert user.info.follower_count == 0
+ assert length(User.following(user)) == 2
+ assert user.follower_count == 0
end
end
@@ -99,10 +99,10 @@ defmodule Mix.Tasks.Pleroma.DatabaseTest do
test "it turns OrderedCollection likes into empty arrays" do
[user, user2] = insert_pair(:user)
- {:ok, %{id: id, object: object}} = CommonAPI.post(user, %{"status" => "test"})
- {:ok, %{object: object2}} = CommonAPI.post(user, %{"status" => "test test"})
+ {:ok, %{id: id, object: object}} = CommonAPI.post(user, %{status: "test"})
+ {:ok, %{object: object2}} = CommonAPI.post(user, %{status: "test test"})
- CommonAPI.favorite(id, user2)
+ CommonAPI.favorite(user2, id)
likes = %{
"first" =>