Fetch user feed on externalprofile request.
[akkoma] / test / web / twitter_api / twitter_api_controller_test.exs
index 05cd084b4fb9cb2c70837bb403a56a0a089f77fc..0e9d29018cabd9c1aa34fc498e1938d69f5eecdd 100644 (file)
@@ -245,6 +245,7 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
 
       {:ok, current_user} = User.follow(current_user, followed)
       assert current_user.following == [User.ap_followers(followed)]
+      ActivityPub.follow(current_user, followed)
 
       conn = conn
       |> with_credentials(current_user.nickname, "test")
@@ -388,6 +389,17 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
     end
   end
 
+  describe "GET /api/externalprofile/show" do
+    test "it returns the user", %{conn: conn} do
+      user = insert(:user)
+
+      conn = conn
+      |> get("/api/externalprofile/show", %{profileurl: user.ap_id})
+
+      assert json_response(conn, 200) == UserRepresenter.to_map(user)
+    end
+  end
+
   defp valid_user(_context) do
     user = insert(:user)
     [user: user]
@@ -397,10 +409,4 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
     header_content = "Basic " <> Base.encode64("#{username}:#{password}")
     put_req_header(conn, "authorization", header_content)
   end
-
-  setup do
-    Supervisor.terminate_child(Pleroma.Supervisor, ConCache)
-    Supervisor.restart_child(Pleroma.Supervisor, ConCache)
-    :ok
-  end
 end