Allign datetime format with mastodon.
[akkoma] / test / web / mastodon_api / mastodon_api_controller_test.exs
index dc925e2c8e769872d3ed126ec623b05e7965d79a..52415bb50550c3ba2db0abed02ae0a7568e6184c 100644 (file)
@@ -165,4 +165,37 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
       assert activity.id == id
     end
   end
+
+  describe "user timelines" do
+    test "gets a users statuses", %{conn: conn} do
+      _note = insert(:note_activity)
+      note_two = insert(:note_activity)
+
+      user = User.get_by_ap_id(note_two.data["actor"])
+
+      conn = conn
+      |> get("/api/v1/accounts/#{user.id}/statuses")
+
+      assert [%{"id" => id}] = json_response(conn, 200)
+
+      assert id == note_two.id
+    end
+  end
+
+  describe "user relationships" do
+    test "returns the relationships for the current user", %{conn: conn} do
+      user = insert(:user)
+      other_user = insert(:user)
+
+      {:ok, user} = User.follow(user, other_user)
+
+      conn = conn
+      |> assign(:user, user)
+      |> get("/api/v1/accounts/relationships", %{"id" => [other_user.id]})
+
+      assert [relationship] = json_response(conn, 200)
+
+      assert other_user.id == relationship["id"]
+    end
+  end
 end