diff options
| author | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2020-02-24 19:21:29 +0000 | 
|---|---|---|
| committer | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2020-02-24 19:21:29 +0000 | 
| commit | 908b6ee49a049e60d705e7f923e71326a965f360 (patch) | |
| tree | edfad3b8ea92b2037ef737a97acaa87d2ee00a34 /test/web | |
| parent | d240ce41b55a557366746fb7e313d3810bd8fe16 (diff) | |
| parent | 7ad5c51f23102e89c491a2ef731e108873a09d71 (diff) | |
| download | pleroma-908b6ee49a049e60d705e7f923e71326a965f360.tar.gz pleroma-908b6ee49a049e60d705e7f923e71326a965f360.zip  | |
Merge branch 'status-visibility-count-stats' into 'develop'
Status count by visibility scope (`GET /api/pleroma/admin/stats` )
See merge request pleroma/pleroma!2097
Diffstat (limited to 'test/web')
| -rw-r--r-- | test/web/admin_api/admin_api_controller_test.exs | 19 | 
1 files changed, 19 insertions, 0 deletions
diff --git a/test/web/admin_api/admin_api_controller_test.exs b/test/web/admin_api/admin_api_controller_test.exs index 908ef4d37..0b79e4c5c 100644 --- a/test/web/admin_api/admin_api_controller_test.exs +++ b/test/web/admin_api/admin_api_controller_test.exs @@ -3545,6 +3545,25 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do      assert String.starts_with?(child["group"], ":")      assert child["description"]    end + +  describe "/api/pleroma/admin/stats" do +    test "status visibility count", %{conn: conn} do +      admin = insert(:user, is_admin: true) +      user = insert(:user) +      CommonAPI.post(user, %{"visibility" => "public", "status" => "hey"}) +      CommonAPI.post(user, %{"visibility" => "unlisted", "status" => "hey"}) +      CommonAPI.post(user, %{"visibility" => "unlisted", "status" => "hey"}) + +      response = +        conn +        |> assign(:user, admin) +        |> get("/api/pleroma/admin/stats") +        |> json_response(200) + +      assert %{"direct" => 0, "private" => 0, "public" => 1, "unlisted" => 2} = +               response["status_visibility"] +    end +  end  end  # Needed for testing  | 
