Test for MastoAPI /api/v1/instance response structure.
authorIvan Tashkinov <ivant.business@gmail.com>
Tue, 26 Mar 2019 15:13:24 +0000 (18:13 +0300)
committerIvan Tashkinov <ivant.business@gmail.com>
Tue, 26 Mar 2019 15:13:24 +0000 (18:13 +0300)
test/web/mastodon_api/mastodon_api_controller_test.exs

index b2302422b6aac7792f9872b0354e282237375d5b..aa9abe97db472571456b2a216a17e98ab6a05bbb 100644 (file)
@@ -1808,6 +1808,27 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
   end
 
   test "get instance information", %{conn: conn} do
+    conn = get(conn, "/api/v1/instance")
+    assert result = json_response(conn, 200)
+
+    # Note: not checking for "max_toot_chars" since it's optional
+    assert %{
+      "uri" => _,
+      "title" => _,
+      "description" => _,
+      "version" => _,
+      "email" => _,
+      "urls" => %{
+        "streaming_api" => _
+      },
+      "stats" => _,
+      "thumbnail" => _,
+      "languages" => _,
+      "registrations" => _
+    } = result
+  end
+
+  test "get instance stats", %{conn: conn} do
     user = insert(:user, %{local: true})
 
     user2 = insert(:user, %{local: true})