projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
format
[akkoma]
/
test
/
pleroma
/
web
/
mastodon_api
/
update_credentials_test.exs
diff --git
a/test/pleroma/web/mastodon_api/update_credentials_test.exs
b/test/pleroma/web/mastodon_api/update_credentials_test.exs
index e99508cd850359b3281c593ac50981d952cc39aa..1d20278998923323feec3335e0c7e95722b4b870 100644
(file)
--- a/
test/pleroma/web/mastodon_api/update_credentials_test.exs
+++ b/
test/pleroma/web/mastodon_api/update_credentials_test.exs
@@
-1,5
+1,5
@@
# Pleroma: A lightweight social networking server
# Pleroma: A lightweight social networking server
-# Copyright © 2017-202
0
Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-202
1
Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.UpdateCredentialsTest do
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.UpdateCredentialsTest do
@@
-11,8
+11,6
@@
defmodule Pleroma.Web.MastodonAPI.UpdateCredentialsTest do
import Mock
import Pleroma.Factory
import Mock
import Pleroma.Factory
- setup do: clear_config([:instance, :max_account_fields])
-
describe "updating credentials" do
setup do: oauth_access(["write:accounts"])
setup :request_content_type
describe "updating credentials" do
setup do: oauth_access(["write:accounts"])
setup :request_content_type
@@
-37,8
+35,8
@@
defmodule Pleroma.Web.MastodonAPI.UpdateCredentialsTest do
|> assign(:user, user)
|> patch("/api/v1/accounts/update_credentials", %{
"pleroma_settings_store" => %{
|> assign(:user, user)
|> patch("/api/v1/accounts/update_credentials", %{
"pleroma_settings_store" => %{
-
masto
_fe: %{
- theme: "bla"
+
soapbox
_fe: %{
+ theme
Mode
: "bla"
}
}
})
}
}
})
@@
-48,7
+46,7
@@
defmodule Pleroma.Web.MastodonAPI.UpdateCredentialsTest do
assert user_data["pleroma"]["settings_store"] ==
%{
"pleroma_fe" => %{"theme" => "bla"},
assert user_data["pleroma"]["settings_store"] ==
%{
"pleroma_fe" => %{"theme" => "bla"},
- "
masto_fe" => %{"them
e" => "bla"}
+ "
soapbox_fe" => %{"themeMod
e" => "bla"}
}
user = Repo.get(User, user_data["id"])
}
user = Repo.get(User, user_data["id"])
@@
-62,8
+60,8
@@
defmodule Pleroma.Web.MastodonAPI.UpdateCredentialsTest do
|> assign(:user, user)
|> patch("/api/v1/accounts/update_credentials", %{
"pleroma_settings_store" => %{
|> assign(:user, user)
|> patch("/api/v1/accounts/update_credentials", %{
"pleroma_settings_store" => %{
-
masto
_fe: %{
- theme: "blub"
+
soapbox
_fe: %{
+ theme
Mode
: "blub"
}
}
})
}
}
})
@@
-73,7
+71,7
@@
defmodule Pleroma.Web.MastodonAPI.UpdateCredentialsTest do
assert user_data["pleroma"]["settings_store"] ==
%{
"pleroma_fe" => %{"theme" => "bla"},
assert user_data["pleroma"]["settings_store"] ==
%{
"pleroma_fe" => %{"theme" => "bla"},
- "
masto_fe" => %{"them
e" => "blub"}
+ "
soapbox_fe" => %{"themeMod
e" => "blub"}
}
assert_called(Pleroma.Web.Federator.publish(:_))
}
assert_called(Pleroma.Web.Federator.publish(:_))
@@
-90,9
+88,7
@@
defmodule Pleroma.Web.MastodonAPI.UpdateCredentialsTest do
assert user_data = json_response_and_validate_schema(conn, 200)
assert user_data["note"] ==
assert user_data = json_response_and_validate_schema(conn, 200)
assert user_data["note"] ==
- ~s(I drink <a class="hashtag" data-tag="cofe" href="http://localhost:4001/tag/cofe">#cofe</a> with <span class="h-card"><a class="u-url mention" data-user="#{
- user2.id
- }" href="#{user2.ap_id}" rel="ugc">@<span>#{user2.nickname}</span></a></span><br/><br/>suya..)
+ ~s(I drink <a class="hashtag" data-tag="cofe" href="http://localhost:4001/tag/cofe">#cofe</a> with <span class="h-card"><a class="u-url mention" data-user="#{user2.id}" href="#{user2.ap_id}" rel="ugc">@<span>#{user2.nickname}</span></a></span><br/><br/>suya..)
assert user_data["source"]["note"] == raw_bio
assert user_data["source"]["note"] == raw_bio
@@
-230,6
+226,15
@@
defmodule Pleroma.Web.MastodonAPI.UpdateCredentialsTest do
assert user_data["pleroma"]["also_known_as"] == ["https://mushroom.kingdom/users/mario"]
end
assert user_data["pleroma"]["also_known_as"] == ["https://mushroom.kingdom/users/mario"]
end
+ test "doesn't update non-url akas", %{conn: conn} do
+ conn =
+ patch(conn, "/api/v1/accounts/update_credentials", %{
+ "also_known_as" => ["aReallyCoolGuy"]
+ })
+
+ assert json_response_and_validate_schema(conn, 403)
+ end
+
test "updates the user's avatar", %{user: user, conn: conn} do
new_avatar = %Plug.Upload{
content_type: "image/jpeg",
test "updates the user's avatar", %{user: user, conn: conn} do
new_avatar = %Plug.Upload{
content_type: "image/jpeg",
@@
-456,7
+461,7
@@
defmodule Pleroma.Web.MastodonAPI.UpdateCredentialsTest do
|> patch("/api/v1/accounts/update_credentials", %{"fields_attributes" => fields})
|> json_response_and_validate_schema(403)
|> patch("/api/v1/accounts/update_credentials", %{"fields_attributes" => fields})
|> json_response_and_validate_schema(403)
-
Pleroma.Config.put
([:instance, :max_account_fields], 1)
+
clear_config
([:instance, :max_account_fields], 1)
fields = [
%{"name" => "foo", "value" => "bar"},
fields = [
%{"name" => "foo", "value" => "bar"},