Fix some test warnings.
[akkoma] / test / web / mastodon_api / mastodon_api_controller_test.exs
index 79ad671d9bf158f466ecb516f4493840aa3db34a..e4c59d9ffa1916a1d6e9c51e8c04d678edb4bcd6 100644 (file)
@@ -530,7 +530,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
   end
 
   describe "updating credentials" do
-    test "updates the user's bio" do
+    test "updates the user's bio", %{conn: conn} do
       user = insert(:user)
 
       conn = conn
@@ -541,7 +541,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
       assert user["note"] == "I drink #cofe"
     end
 
-    test "updates the user's name" do
+    test "updates the user's name", %{conn: conn} do
       user = insert(:user)
 
       conn = conn
@@ -552,7 +552,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
       assert user["display_name"] == "markorepairs"
     end
 
-    test "updates the user's avatar" do
+    test "updates the user's avatar", %{conn: conn} do
       user = insert(:user)
 
       new_avatar = %Plug.Upload{content_type: "image/jpg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg"}
@@ -565,7 +565,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
       assert user["avatar"] != "https://placehold.it/48x48"
     end
 
-    test "updates the user's banner" do
+    test "updates the user's banner", %{conn: conn} do
       user = insert(:user)
 
       new_header = %Plug.Upload{content_type: "image/jpg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg"}
@@ -579,18 +579,21 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
     end
   end
 
-  test "get instance information" do
+  test "get instance information", %{conn: conn} do
     insert(:user, %{local: true})
     user = insert(:user, %{local: true})
     insert(:user, %{local: false})
 
     {:ok, _} = TwitterAPI.create_status(user, %{"status" => "cofe"})
 
+    Pleroma.Stats.update_stats()
+
     conn = conn
     |> get("/api/v1/instance")
 
     assert result = json_response(conn, 200)
 
     assert result["stats"]["user_count"] == 2
+    assert result["stats"]["status_count"] == 1
   end
 end