Add a test for accounts/update_credentials
authorEgor Kislitsyn <egor@kislitsyn.com>
Wed, 25 Mar 2020 14:46:17 +0000 (18:46 +0400)
committerEgor Kislitsyn <egor@kislitsyn.com>
Wed, 25 Mar 2020 14:46:17 +0000 (18:46 +0400)
test/web/mastodon_api/controllers/account_controller/update_credentials_test.exs

index 51cebe567f6fe1d3cc5d64f2ce47c987e0ce1b21..b693c1a47603401240fee96c0d7a89191c13aaf8 100644 (file)
@@ -118,6 +118,18 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController.UpdateCredentialsTest do
       assert user_data["pleroma"]["hide_followers"] == true
     end
 
+    test "updates the user's discoverable status", %{conn: conn} do
+      assert %{"source" => %{"pleroma" => %{"discoverable" => true}}} =
+               conn
+               |> patch("/api/v1/accounts/update_credentials", %{discoverable: "true"})
+               |> json_response(:ok)
+
+      assert %{"source" => %{"pleroma" => %{"discoverable" => false}}} =
+               conn
+               |> patch("/api/v1/accounts/update_credentials", %{discoverable: "false"})
+               |> json_response(:ok)
+    end
+
     test "updates the user's hide_followers_count and hide_follows_count", %{conn: conn} do
       conn =
         patch(conn, "/api/v1/accounts/update_credentials", %{