replace `Repo.get_by(User, ap_id: ap_id)` with `User.get_by_ap_id(ap_id)`
authorEgor Kislitsyn <egor@kislitsyn.com>
Tue, 2 Apr 2019 10:47:52 +0000 (17:47 +0700)
committerEgor Kislitsyn <egor@kislitsyn.com>
Tue, 2 Apr 2019 10:47:52 +0000 (17:47 +0700)
test/web/activity_pub/activity_pub_test.exs
test/web/mastodon_api/status_view_test.exs
test/web/salmon/salmon_test.exs
test/web/twitter_api/twitter_api_controller_test.exs

index 7969c8035ba0a8a2007b73b1085bf7036967b055..46b4cf7b6d18d232bbf73eb7a5591f452080ae0a 100644 (file)
@@ -638,8 +638,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
   describe "fetch the latest Follow" do
     test "fetches the latest Follow activity" do
       %Activity{data: %{"type" => "Follow"}} = activity = insert(:follow_activity)
-      follower = Repo.get_by(User, ap_id: activity.data["actor"])
-      followed = Repo.get_by(User, ap_id: activity.data["object"])
+      follower = User.get_by_ap_id(activity.data["actor"])
+      followed = User.get_by_ap_id(activity.data["object"])
 
       assert activity == Utils.fetch_latest_follow(follower, followed)
     end
index e1c9b2c8f61a03897673143f77800204d8b346ae..8db92ac160fd43efe0d8cf138d3115eb81eb7db4 100644 (file)
@@ -175,7 +175,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
 
     status = StatusView.render("status.json", %{activity: activity})
 
-    actor = Repo.get_by(User, ap_id: activity.actor)
+    actor = User.get_by_ap_id(activity.actor)
 
     assert status.mentions ==
              Enum.map([user, actor], fn u -> AccountView.render("mention.json", %{user: u}) end)
index 265e1abbd44588dac1674851f3ece4b0c54ce7de..35503259b933cd2cfe0ba39a5553e4a836cdcffe 100644 (file)
@@ -99,7 +99,7 @@ defmodule Pleroma.Web.Salmon.SalmonTest do
     }
 
     {:ok, activity} = Repo.insert(%Activity{data: activity_data, recipients: activity_data["to"]})
-    user = Repo.get_by(User, ap_id: activity.data["actor"])
+    user = User.get_by_ap_id(activity.data["actor"])
     {:ok, user} = Pleroma.Web.WebFinger.ensure_keys_present(user)
 
     poster = fn url, _data, _headers ->
index dffd401f74e34944f56e5b8420210750d095c1f5..405f0cfae52be218102b2b6978b89ed56f8aad01 100644 (file)
@@ -955,7 +955,7 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
         |> post(request_path)
 
       activity = Activity.get_by_id(note_activity.id)
-      activity_user = Repo.get_by(User, ap_id: note_activity.data["actor"])
+      activity_user = User.get_by_ap_id(note_activity.data["actor"])
 
       assert json_response(response, 200) ==
                ActivityView.render("activity.json", %{
@@ -993,7 +993,7 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
         |> post(request_path)
 
       activity = Activity.get_by_id(note_activity.id)
-      activity_user = Repo.get_by(User, ap_id: note_activity.data["actor"])
+      activity_user = User.get_by_ap_id(note_activity.data["actor"])
 
       assert json_response(response, 200) ==
                ActivityView.render("activity.json", %{