e9b8825bfb7801f7c5507175ecb2fb9b82dbbf31
[akkoma] / test / pleroma / web / mastodon_api / update_credentials_test.exs
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.MastodonAPI.UpdateCredentialsTest do
6 alias Pleroma.Repo
7 alias Pleroma.User
8
9 use Pleroma.Web.ConnCase
10
11 import Mock
12 import Pleroma.Factory
13
14 describe "updating credentials" do
15 setup do: oauth_access(["write:accounts"])
16 setup :request_content_type
17
18 test "sets user settings in a generic way", %{conn: conn} do
19 res_conn =
20 patch(conn, "/api/v1/accounts/update_credentials", %{
21 "pleroma_settings_store" => %{
22 pleroma_fe: %{
23 theme: "bla"
24 }
25 }
26 })
27
28 assert user_data = json_response_and_validate_schema(res_conn, 200)
29 assert user_data["pleroma"]["settings_store"] == %{"pleroma_fe" => %{"theme" => "bla"}}
30
31 user = Repo.get(User, user_data["id"])
32
33 res_conn =
34 conn
35 |> assign(:user, user)
36 |> patch("/api/v1/accounts/update_credentials", %{
37 "pleroma_settings_store" => %{
38 masto_fe: %{
39 theme: "bla"
40 }
41 }
42 })
43
44 assert user_data = json_response_and_validate_schema(res_conn, 200)
45
46 assert user_data["pleroma"]["settings_store"] ==
47 %{
48 "pleroma_fe" => %{"theme" => "bla"},
49 "masto_fe" => %{"theme" => "bla"}
50 }
51
52 user = Repo.get(User, user_data["id"])
53
54 clear_config([:instance, :federating], true)
55
56 with_mock Pleroma.Web.Federator,
57 publish: fn _activity -> :ok end do
58 res_conn =
59 conn
60 |> assign(:user, user)
61 |> patch("/api/v1/accounts/update_credentials", %{
62 "pleroma_settings_store" => %{
63 masto_fe: %{
64 theme: "blub"
65 }
66 }
67 })
68
69 assert user_data = json_response_and_validate_schema(res_conn, 200)
70
71 assert user_data["pleroma"]["settings_store"] ==
72 %{
73 "pleroma_fe" => %{"theme" => "bla"},
74 "masto_fe" => %{"theme" => "blub"}
75 }
76
77 assert_called(Pleroma.Web.Federator.publish(:_))
78 end
79 end
80
81 test "updates the user's bio", %{conn: conn} do
82 user2 = insert(:user)
83
84 raw_bio = "I drink #cofe with @#{user2.nickname}\n\nsuya.."
85
86 conn = patch(conn, "/api/v1/accounts/update_credentials", %{"note" => raw_bio})
87
88 assert user_data = json_response_and_validate_schema(conn, 200)
89
90 assert user_data["note"] ==
91 ~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..)
92
93 assert user_data["source"]["note"] == raw_bio
94
95 user = Repo.get(User, user_data["id"])
96
97 assert user.raw_bio == raw_bio
98 end
99
100 test "updates the user's locking status", %{conn: conn} do
101 conn = patch(conn, "/api/v1/accounts/update_credentials", %{locked: "true"})
102
103 assert user_data = json_response_and_validate_schema(conn, 200)
104 assert user_data["locked"] == true
105 end
106
107 test "updates the user's allow_following_move", %{user: user, conn: conn} do
108 assert user.allow_following_move == true
109
110 conn = patch(conn, "/api/v1/accounts/update_credentials", %{allow_following_move: "false"})
111
112 assert refresh_record(user).allow_following_move == false
113 assert user_data = json_response_and_validate_schema(conn, 200)
114 assert user_data["pleroma"]["allow_following_move"] == false
115 end
116
117 test "updates the user's default scope", %{conn: conn} do
118 conn = patch(conn, "/api/v1/accounts/update_credentials", %{default_scope: "unlisted"})
119
120 assert user_data = json_response_and_validate_schema(conn, 200)
121 assert user_data["source"]["privacy"] == "unlisted"
122 end
123
124 test "updates the user's privacy", %{conn: conn} do
125 conn = patch(conn, "/api/v1/accounts/update_credentials", %{source: %{privacy: "unlisted"}})
126
127 assert user_data = json_response_and_validate_schema(conn, 200)
128 assert user_data["source"]["privacy"] == "unlisted"
129 end
130
131 test "updates the user's hide_followers status", %{conn: conn} do
132 conn = patch(conn, "/api/v1/accounts/update_credentials", %{hide_followers: "true"})
133
134 assert user_data = json_response_and_validate_schema(conn, 200)
135 assert user_data["pleroma"]["hide_followers"] == true
136 end
137
138 test "updates the user's discoverable status", %{conn: conn} do
139 assert %{"source" => %{"pleroma" => %{"discoverable" => true}}} =
140 conn
141 |> patch("/api/v1/accounts/update_credentials", %{discoverable: "true"})
142 |> json_response_and_validate_schema(:ok)
143
144 assert %{"source" => %{"pleroma" => %{"discoverable" => false}}} =
145 conn
146 |> patch("/api/v1/accounts/update_credentials", %{discoverable: "false"})
147 |> json_response_and_validate_schema(:ok)
148 end
149
150 test "updates the user's hide_followers_count and hide_follows_count", %{conn: conn} do
151 conn =
152 patch(conn, "/api/v1/accounts/update_credentials", %{
153 hide_followers_count: "true",
154 hide_follows_count: "true"
155 })
156
157 assert user_data = json_response_and_validate_schema(conn, 200)
158 assert user_data["pleroma"]["hide_followers_count"] == true
159 assert user_data["pleroma"]["hide_follows_count"] == true
160 end
161
162 test "updates the user's skip_thread_containment option", %{user: user, conn: conn} do
163 response =
164 conn
165 |> patch("/api/v1/accounts/update_credentials", %{skip_thread_containment: "true"})
166 |> json_response_and_validate_schema(200)
167
168 assert response["pleroma"]["skip_thread_containment"] == true
169 assert refresh_record(user).skip_thread_containment
170 end
171
172 test "updates the user's hide_follows status", %{conn: conn} do
173 conn = patch(conn, "/api/v1/accounts/update_credentials", %{hide_follows: "true"})
174
175 assert user_data = json_response_and_validate_schema(conn, 200)
176 assert user_data["pleroma"]["hide_follows"] == true
177 end
178
179 test "updates the user's hide_favorites status", %{conn: conn} do
180 conn = patch(conn, "/api/v1/accounts/update_credentials", %{hide_favorites: "true"})
181
182 assert user_data = json_response_and_validate_schema(conn, 200)
183 assert user_data["pleroma"]["hide_favorites"] == true
184 end
185
186 test "updates the user's show_role status", %{conn: conn} do
187 conn = patch(conn, "/api/v1/accounts/update_credentials", %{show_role: "false"})
188
189 assert user_data = json_response_and_validate_schema(conn, 200)
190 assert user_data["source"]["pleroma"]["show_role"] == false
191 end
192
193 test "updates the user's no_rich_text status", %{conn: conn} do
194 conn = patch(conn, "/api/v1/accounts/update_credentials", %{no_rich_text: "true"})
195
196 assert user_data = json_response_and_validate_schema(conn, 200)
197 assert user_data["source"]["pleroma"]["no_rich_text"] == true
198 end
199
200 test "updates the user's name", %{conn: conn} do
201 conn =
202 patch(conn, "/api/v1/accounts/update_credentials", %{"display_name" => "markorepairs"})
203
204 assert user_data = json_response_and_validate_schema(conn, 200)
205 assert user_data["display_name"] == "markorepairs"
206
207 update_activity = Repo.one(Pleroma.Activity)
208 assert update_activity.data["type"] == "Update"
209 assert update_activity.data["object"]["name"] == "markorepairs"
210 end
211
212 test "updates the user's default post expiry", %{conn: conn} do
213 conn = patch(conn, "/api/v1/accounts/update_credentials", %{"status_ttl_days" => "1"})
214
215 assert user_data = json_response_and_validate_schema(conn, 200)
216 assert user_data["akkoma"]["status_ttl_days"] == 1
217 end
218
219 test "resets the user's default post expiry", %{conn: conn} do
220 conn = patch(conn, "/api/v1/accounts/update_credentials", %{"status_ttl_days" => "-1"})
221
222 assert user_data = json_response_and_validate_schema(conn, 200)
223 assert is_nil(user_data["akkoma"]["status_ttl_days"])
224 end
225
226 test "does not allow negative integers other than -1 for TTL", %{conn: conn} do
227 conn = patch(conn, "/api/v1/accounts/update_credentials", %{"status_ttl_days" => "-2"})
228
229 assert json_response_and_validate_schema(conn, 403)
230 end
231
232 test "updates the user's AKAs", %{conn: conn} do
233 conn =
234 patch(conn, "/api/v1/accounts/update_credentials", %{
235 "also_known_as" => ["https://mushroom.kingdom/users/mario"]
236 })
237
238 assert user_data = json_response_and_validate_schema(conn, 200)
239 assert user_data["pleroma"]["also_known_as"] == ["https://mushroom.kingdom/users/mario"]
240 end
241
242 test "doesn't update non-url akas", %{conn: conn} do
243 conn =
244 patch(conn, "/api/v1/accounts/update_credentials", %{
245 "also_known_as" => ["aReallyCoolGuy"]
246 })
247
248 assert json_response_and_validate_schema(conn, 403)
249 end
250
251 test "updates the user's avatar", %{user: user, conn: conn} do
252 new_avatar = %Plug.Upload{
253 content_type: "image/jpeg",
254 path: Path.absname("test/fixtures/image.jpg"),
255 filename: "an_image.jpg"
256 }
257
258 assert user.avatar == %{}
259
260 res = patch(conn, "/api/v1/accounts/update_credentials", %{"avatar" => new_avatar})
261
262 assert user_response = json_response_and_validate_schema(res, 200)
263 assert user_response["avatar"] != User.avatar_url(user)
264
265 user = User.get_by_id(user.id)
266 refute user.avatar == %{}
267
268 # Also resets it
269 _res = patch(conn, "/api/v1/accounts/update_credentials", %{"avatar" => ""})
270
271 user = User.get_by_id(user.id)
272 assert user.avatar == nil
273 end
274
275 test "updates the user's avatar, upload_limit, returns a HTTP 413", %{conn: conn, user: user} do
276 upload_limit = Config.get([:instance, :upload_limit]) * 8 + 8
277
278 assert :ok ==
279 File.write(Path.absname("test/tmp/large_binary.data"), <<0::size(upload_limit)>>)
280
281 new_avatar_oversized = %Plug.Upload{
282 content_type: nil,
283 path: Path.absname("test/tmp/large_binary.data"),
284 filename: "large_binary.data"
285 }
286
287 assert user.avatar == %{}
288
289 res =
290 patch(conn, "/api/v1/accounts/update_credentials", %{"avatar" => new_avatar_oversized})
291
292 assert user_response = json_response_and_validate_schema(res, 413)
293 assert user_response["avatar"] != User.avatar_url(user)
294
295 user = User.get_by_id(user.id)
296 assert user.avatar == %{}
297
298 clear_config([:instance, :upload_limit], upload_limit)
299
300 assert :ok == File.rm(Path.absname("test/tmp/large_binary.data"))
301 end
302
303 test "updates the user's banner", %{user: user, conn: conn} do
304 new_header = %Plug.Upload{
305 content_type: "image/jpeg",
306 path: Path.absname("test/fixtures/image.jpg"),
307 filename: "an_image.jpg"
308 }
309
310 res = patch(conn, "/api/v1/accounts/update_credentials", %{"header" => new_header})
311
312 assert user_response = json_response_and_validate_schema(res, 200)
313 assert user_response["header"] != User.banner_url(user)
314
315 # Also resets it
316 _res = patch(conn, "/api/v1/accounts/update_credentials", %{"header" => ""})
317
318 user = User.get_by_id(user.id)
319 assert user.banner == nil
320 end
321
322 test "updates the user's banner, upload_limit, returns a HTTP 413", %{conn: conn, user: user} do
323 upload_limit = Config.get([:instance, :upload_limit]) * 8 + 8
324
325 assert :ok ==
326 File.write(Path.absname("test/tmp/large_binary.data"), <<0::size(upload_limit)>>)
327
328 new_header_oversized = %Plug.Upload{
329 content_type: nil,
330 path: Path.absname("test/tmp/large_binary.data"),
331 filename: "large_binary.data"
332 }
333
334 res =
335 patch(conn, "/api/v1/accounts/update_credentials", %{"header" => new_header_oversized})
336
337 assert user_response = json_response_and_validate_schema(res, 413)
338 assert user_response["header"] != User.banner_url(user)
339
340 user = User.get_by_id(user.id)
341 assert user.banner == %{}
342
343 clear_config([:instance, :upload_limit], upload_limit)
344
345 assert :ok == File.rm(Path.absname("test/tmp/large_binary.data"))
346 end
347
348 test "updates the user's background", %{conn: conn, user: user} do
349 new_header = %Plug.Upload{
350 content_type: "image/jpeg",
351 path: Path.absname("test/fixtures/image.jpg"),
352 filename: "an_image.jpg"
353 }
354
355 res =
356 patch(conn, "/api/v1/accounts/update_credentials", %{
357 "pleroma_background_image" => new_header
358 })
359
360 assert user_response = json_response_and_validate_schema(res, 200)
361 assert user_response["pleroma"]["background_image"]
362 #
363 # Also resets it
364 _res =
365 patch(conn, "/api/v1/accounts/update_credentials", %{"pleroma_background_image" => ""})
366
367 user = User.get_by_id(user.id)
368 assert user.background == nil
369 end
370
371 test "updates the user's background, upload_limit, returns a HTTP 413", %{
372 conn: conn,
373 user: user
374 } do
375 upload_limit = Config.get([:instance, :upload_limit]) * 8 + 8
376
377 assert :ok ==
378 File.write(Path.absname("test/tmp/large_binary.data"), <<0::size(upload_limit)>>)
379
380 new_background_oversized = %Plug.Upload{
381 content_type: nil,
382 path: Path.absname("test/tmp/large_binary.data"),
383 filename: "large_binary.data"
384 }
385
386 res =
387 patch(conn, "/api/v1/accounts/update_credentials", %{
388 "pleroma_background_image" => new_background_oversized
389 })
390
391 assert json_response_and_validate_schema(res, 413)
392 assert user.background == %{}
393
394 clear_config([:instance, :upload_limit], upload_limit)
395
396 assert :ok == File.rm(Path.absname("test/tmp/large_binary.data"))
397 end
398
399 test "requires 'write:accounts' permission" do
400 token1 = insert(:oauth_token, scopes: ["read"])
401 token2 = insert(:oauth_token, scopes: ["write", "follow"])
402
403 for token <- [token1, token2] do
404 conn =
405 build_conn()
406 |> put_req_header("content-type", "multipart/form-data")
407 |> put_req_header("authorization", "Bearer #{token.token}")
408 |> patch("/api/v1/accounts/update_credentials", %{})
409
410 if token == token1 do
411 assert %{"error" => "Insufficient permissions: write:accounts."} ==
412 json_response_and_validate_schema(conn, 403)
413 else
414 assert json_response_and_validate_schema(conn, 200)
415 end
416 end
417 end
418
419 test "updates profile emojos", %{user: user, conn: conn} do
420 note = "*sips :blank:*"
421 name = "I am :firefox:"
422
423 ret_conn =
424 patch(conn, "/api/v1/accounts/update_credentials", %{
425 "note" => note,
426 "display_name" => name
427 })
428
429 assert json_response_and_validate_schema(ret_conn, 200)
430
431 conn = get(conn, "/api/v1/accounts/#{user.id}")
432
433 assert user_data = json_response_and_validate_schema(conn, 200)
434
435 assert user_data["note"] == note
436 assert user_data["display_name"] == name
437 assert [%{"shortcode" => "blank"}, %{"shortcode" => "firefox"}] = user_data["emojis"]
438 end
439
440 test "update fields", %{conn: conn} do
441 fields = [
442 %{name: "<a href=\"http://google.com\">foo</a>", value: "<script>bar</script>"},
443 %{name: "link.io", value: "cofe.io"}
444 ]
445
446 account_data =
447 conn
448 |> patch("/api/v1/accounts/update_credentials", %{fields_attributes: fields})
449 |> json_response_and_validate_schema(200)
450
451 assert account_data["fields"] == [
452 %{"name" => "<a href=\"http://google.com\">foo</a>", "value" => "bar"},
453 %{
454 "name" => "link.io",
455 "value" => ~S(<a href="http://cofe.io" rel="ugc">cofe.io</a>)
456 }
457 ]
458
459 assert account_data["source"]["fields"] == [
460 %{
461 "name" => "<a href=\"http://google.com\">foo</a>",
462 "value" => "<script>bar</script>"
463 },
464 %{"name" => "link.io", "value" => "cofe.io"}
465 ]
466 end
467
468 test "update fields with a link to content with rel=me, with ap id", %{user: user, conn: conn} do
469 Tesla.Mock.mock(fn
470 %{url: "http://example.com/rel_me/ap_id"} ->
471 %Tesla.Env{
472 status: 200,
473 body: ~s[<html><head><link rel="me" href="#{user.ap_id}"></head></html>]
474 }
475 end)
476
477 field = %{name: "Website", value: "http://example.com/rel_me/ap_id"}
478
479 account_data =
480 conn
481 |> patch("/api/v1/accounts/update_credentials", %{fields_attributes: [field]})
482 |> json_response_and_validate_schema(200)
483
484 assert [
485 %{
486 "name" => "Website",
487 "value" =>
488 ~s[<a href="http://example.com/rel_me/ap_id" rel="ugc">http://example.com/rel_me/ap_id</a>],
489 "verified_at" => verified_at
490 }
491 ] = account_data["fields"]
492
493 {:ok, verified_at, _} = DateTime.from_iso8601(verified_at)
494 assert DateTime.diff(DateTime.utc_now(), verified_at) < 10
495 end
496
497 test "update fields with a link to content with rel=me, with frontend path", %{
498 user: user,
499 conn: conn
500 } do
501 fe_url = "#{Pleroma.Web.Endpoint.url()}/#{user.nickname}"
502
503 Tesla.Mock.mock(fn
504 %{url: "http://example.com/rel_me/fe_path"} ->
505 %Tesla.Env{
506 status: 200,
507 body: ~s[<html><head><link rel="me" href="#{fe_url}"></head></html>]
508 }
509 end)
510
511 field = %{name: "Website", value: "http://example.com/rel_me/fe_path"}
512
513 account_data =
514 conn
515 |> patch("/api/v1/accounts/update_credentials", %{fields_attributes: [field]})
516 |> json_response_and_validate_schema(200)
517
518 assert [
519 %{
520 "name" => "Website",
521 "value" =>
522 ~s[<a href="http://example.com/rel_me/fe_path" rel="ugc">http://example.com/rel_me/fe_path</a>],
523 "verified_at" => verified_at
524 }
525 ] = account_data["fields"]
526
527 {:ok, verified_at, _} = DateTime.from_iso8601(verified_at)
528 assert DateTime.diff(DateTime.utc_now(), verified_at) < 10
529 end
530
531 test "emojis in fields labels", %{conn: conn} do
532 fields = [
533 %{name: ":firefox:", value: "is best 2hu"},
534 %{name: "they wins", value: ":blank:"}
535 ]
536
537 account_data =
538 conn
539 |> patch("/api/v1/accounts/update_credentials", %{fields_attributes: fields})
540 |> json_response_and_validate_schema(200)
541
542 assert account_data["fields"] == [
543 %{"name" => ":firefox:", "value" => "is best 2hu"},
544 %{"name" => "they wins", "value" => ":blank:"}
545 ]
546
547 assert account_data["source"]["fields"] == [
548 %{"name" => ":firefox:", "value" => "is best 2hu"},
549 %{"name" => "they wins", "value" => ":blank:"}
550 ]
551
552 assert [%{"shortcode" => "blank"}, %{"shortcode" => "firefox"}] = account_data["emojis"]
553 end
554
555 test "update fields via x-www-form-urlencoded", %{conn: conn} do
556 fields =
557 [
558 "fields_attributes[1][name]=link",
559 "fields_attributes[1][value]=http://cofe.io",
560 "fields_attributes[0][name]=foo",
561 "fields_attributes[0][value]=bar"
562 ]
563 |> Enum.join("&")
564
565 account =
566 conn
567 |> put_req_header("content-type", "application/x-www-form-urlencoded")
568 |> patch("/api/v1/accounts/update_credentials", fields)
569 |> json_response_and_validate_schema(200)
570
571 assert account["fields"] == [
572 %{"name" => "foo", "value" => "bar"},
573 %{
574 "name" => "link",
575 "value" => ~S(<a href="http://cofe.io" rel="ugc">http://cofe.io</a>)
576 }
577 ]
578
579 assert account["source"]["fields"] == [
580 %{"name" => "foo", "value" => "bar"},
581 %{"name" => "link", "value" => "http://cofe.io"}
582 ]
583 end
584
585 test "update fields with empty name", %{conn: conn} do
586 fields = [
587 %{name: "foo", value: ""},
588 %{name: "", value: "bar"}
589 ]
590
591 account =
592 conn
593 |> patch("/api/v1/accounts/update_credentials", %{fields_attributes: fields})
594 |> json_response_and_validate_schema(200)
595
596 assert account["fields"] == [
597 %{"name" => "foo", "value" => ""}
598 ]
599 end
600
601 test "update fields when invalid request", %{conn: conn} do
602 name_limit = Pleroma.Config.get([:instance, :account_field_name_length])
603 value_limit = Pleroma.Config.get([:instance, :account_field_value_length])
604
605 long_name = Enum.map(0..name_limit, fn _ -> "x" end) |> Enum.join()
606 long_value = Enum.map(0..value_limit, fn _ -> "x" end) |> Enum.join()
607
608 fields = [%{name: "foo", value: long_value}]
609
610 assert %{"error" => "Invalid request"} ==
611 conn
612 |> patch("/api/v1/accounts/update_credentials", %{fields_attributes: fields})
613 |> json_response_and_validate_schema(403)
614
615 fields = [%{name: long_name, value: "bar"}]
616
617 assert %{"error" => "Invalid request"} ==
618 conn
619 |> patch("/api/v1/accounts/update_credentials", %{fields_attributes: fields})
620 |> json_response_and_validate_schema(403)
621
622 clear_config([:instance, :max_account_fields], 1)
623
624 fields = [
625 %{name: "foo", value: "bar"},
626 %{"name" => "link", "value" => "cofe.io"}
627 ]
628
629 assert %{"error" => "Invalid request"} ==
630 conn
631 |> patch("/api/v1/accounts/update_credentials", %{fields_attributes: fields})
632 |> json_response_and_validate_schema(403)
633 end
634 end
635
636 describe "Mark account as bot" do
637 setup do: oauth_access(["write:accounts"])
638 setup :request_content_type
639
640 test "changing actor_type to Service makes account a bot", %{conn: conn} do
641 account =
642 conn
643 |> patch("/api/v1/accounts/update_credentials", %{actor_type: "Service"})
644 |> json_response_and_validate_schema(200)
645
646 assert account["bot"]
647 assert account["source"]["pleroma"]["actor_type"] == "Service"
648 end
649
650 test "changing actor_type to Person makes account a human", %{conn: conn} do
651 account =
652 conn
653 |> patch("/api/v1/accounts/update_credentials", %{actor_type: "Person"})
654 |> json_response_and_validate_schema(200)
655
656 refute account["bot"]
657 assert account["source"]["pleroma"]["actor_type"] == "Person"
658 end
659
660 test "changing actor_type to Application causes error", %{conn: conn} do
661 response =
662 conn
663 |> patch("/api/v1/accounts/update_credentials", %{actor_type: "Application"})
664 |> json_response_and_validate_schema(403)
665
666 assert %{"error" => "Invalid request"} == response
667 end
668
669 test "changing bot field to true changes actor_type to Service", %{conn: conn} do
670 account =
671 conn
672 |> patch("/api/v1/accounts/update_credentials", %{bot: "true"})
673 |> json_response_and_validate_schema(200)
674
675 assert account["bot"]
676 assert account["source"]["pleroma"]["actor_type"] == "Service"
677 end
678
679 test "changing bot field to false changes actor_type to Person", %{conn: conn} do
680 account =
681 conn
682 |> patch("/api/v1/accounts/update_credentials", %{bot: "false"})
683 |> json_response_and_validate_schema(200)
684
685 refute account["bot"]
686 assert account["source"]["pleroma"]["actor_type"] == "Person"
687 end
688
689 test "actor_type field has a higher priority than bot", %{conn: conn} do
690 account =
691 conn
692 |> patch("/api/v1/accounts/update_credentials", %{
693 actor_type: "Person",
694 bot: "true"
695 })
696 |> json_response_and_validate_schema(200)
697
698 refute account["bot"]
699 assert account["source"]["pleroma"]["actor_type"] == "Person"
700 end
701 end
702 end