Fetch user feed on externalprofile request.
[akkoma] / test / web / twitter_api / twitter_api_test.exs
index da880e67c5652e6b8d5dc6a94b69b20d6f6f73d7..adea67422c08a608c0eb6f0d5bf4a8288b83b9bb 100644 (file)
@@ -34,7 +34,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do
 
     { :ok, activity = %Activity{} } = TwitterAPI.create_status(user, input)
 
-    assert get_in(activity.data, ["object", "content"]) == "Hello again, <a href='shp'>@shp</a>.<br>\nThis is on another line. #2hu #epic #phantasmagoric<br>\n<a href='http://example.org/image.jpg' class='attachment'>image.jpg</a>"
+    assert get_in(activity.data, ["object", "content"]) == "Hello again, <a href='shp'>@shp</a>.<br>\nThis is on another line. #2hu #epic #phantasmagoric<br>\n<a href=\"http://example.org/image.jpg\" class='attachment'>image.jpg</a>"
     assert get_in(activity.data, ["object", "type"]) == "Note"
     assert get_in(activity.data, ["object", "actor"]) == user.ap_id
     assert get_in(activity.data, ["actor"]) == user.ap_id
@@ -353,10 +353,15 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do
 
   describe "fetching a user by uri" do
     test "fetches a user by uri" do
+      id = "https://mastodon.social/users/lambadalambda"
       user = insert(:user)
+      {:ok, represented} = TwitterAPI.get_external_profile(user, id)
+      remote = User.get_by_ap_id(id)
 
-      {:ok, represented} = TwitterAPI.get_external_profile(user, user.ap_id)
-      assert represented = UserRepresenter.to_map(user, %{for: user})
+      assert represented == UserRepresenter.to_map(remote, %{for: user})
+
+      # Also fetches the feed.
+      assert Activity.get_create_activity_by_object_ap_id("tag:mastodon.social,2017-04-05:objectId=1641750:objectType=Status")
     end
   end
 end