Merging with develop
[akkoma] / test / web / twitter_api / twitter_api_test.exs
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do
6 use Pleroma.DataCase
7 alias Pleroma.Activity
8 alias Pleroma.Object
9 alias Pleroma.Repo
10 alias Pleroma.User
11 alias Pleroma.UserInviteToken
12 alias Pleroma.Web.ActivityPub.ActivityPub
13 alias Pleroma.Web.TwitterAPI.ActivityView
14 alias Pleroma.Web.TwitterAPI.TwitterAPI
15 alias Pleroma.Web.TwitterAPI.UserView
16
17 import Pleroma.Factory
18
19 setup_all do
20 Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
21 :ok
22 end
23
24 test "create a status" do
25 user = insert(:user)
26 mentioned_user = insert(:user, %{nickname: "shp", ap_id: "shp"})
27
28 object_data = %{
29 "type" => "Image",
30 "url" => [
31 %{
32 "type" => "Link",
33 "mediaType" => "image/jpg",
34 "href" => "http://example.org/image.jpg"
35 }
36 ],
37 "uuid" => 1
38 }
39
40 object = Repo.insert!(%Object{data: object_data})
41
42 input = %{
43 "status" =>
44 "Hello again, @shp.<script></script>\nThis is on another :firefox: line. #2hu #epic #phantasmagoric",
45 "media_ids" => [object.id]
46 }
47
48 {:ok, activity = %Activity{}} = TwitterAPI.create_status(user, input)
49 object = Object.normalize(activity.data["object"])
50
51 expected_text =
52 "Hello again, <span class='h-card'><a data-user='#{mentioned_user.id}' class='u-url mention' href='shp'>@<span>shp</span></a></span>.&lt;script&gt;&lt;/script&gt;<br>This is on another :firefox: line. <a class='hashtag' data-tag='2hu' href='http://localhost:4001/tag/2hu' rel='tag'>#2hu</a> <a class='hashtag' data-tag='epic' href='http://localhost:4001/tag/epic' rel='tag'>#epic</a> <a class='hashtag' data-tag='phantasmagoric' href='http://localhost:4001/tag/phantasmagoric' rel='tag'>#phantasmagoric</a><br><a href=\"http://example.org/image.jpg\" class='attachment'>image.jpg</a>"
53
54 assert get_in(object.data, ["content"]) == expected_text
55 assert get_in(object.data, ["type"]) == "Note"
56 assert get_in(object.data, ["actor"]) == user.ap_id
57 assert get_in(activity.data, ["actor"]) == user.ap_id
58 assert Enum.member?(get_in(activity.data, ["cc"]), User.ap_followers(user))
59
60 assert Enum.member?(
61 get_in(activity.data, ["to"]),
62 "https://www.w3.org/ns/activitystreams#Public"
63 )
64
65 assert Enum.member?(get_in(activity.data, ["to"]), "shp")
66 assert activity.local == true
67
68 assert %{"firefox" => "http://localhost:4001/emoji/Firefox.gif"} = object.data["emoji"]
69
70 # hashtags
71 assert object.data["tag"] == ["2hu", "epic", "phantasmagoric"]
72
73 # Add a context
74 assert is_binary(get_in(activity.data, ["context"]))
75 assert is_binary(get_in(object.data, ["context"]))
76
77 assert is_list(object.data["attachment"])
78
79 assert activity.data["object"] == object.data["id"]
80
81 user = User.get_cached_by_ap_id(user.ap_id)
82
83 assert user.info.note_count == 1
84 end
85
86 test "create a status that is a reply" do
87 user = insert(:user)
88
89 input = %{
90 "status" => "Hello again."
91 }
92
93 {:ok, activity = %Activity{}} = TwitterAPI.create_status(user, input)
94 object = Object.normalize(activity.data["object"])
95
96 input = %{
97 "status" => "Here's your (you).",
98 "in_reply_to_status_id" => activity.id
99 }
100
101 {:ok, reply = %Activity{}} = TwitterAPI.create_status(user, input)
102 reply_object = Object.normalize(reply.data["object"])
103
104 assert get_in(reply.data, ["context"]) == get_in(activity.data, ["context"])
105
106 assert get_in(reply_object.data, ["context"]) == get_in(object.data, ["context"])
107
108 assert get_in(reply_object.data, ["inReplyTo"]) == get_in(activity.data, ["object"])
109 assert Activity.get_in_reply_to_activity(reply).id == activity.id
110 end
111
112 test "Follow another user using user_id" do
113 user = insert(:user)
114 followed = insert(:user)
115
116 {:ok, user, followed, _activity} = TwitterAPI.follow(user, %{"user_id" => followed.id})
117 assert User.ap_followers(followed) in user.following
118
119 {:error, msg} = TwitterAPI.follow(user, %{"user_id" => followed.id})
120 assert msg == "Could not follow user: #{followed.nickname} is already on your list."
121 end
122
123 test "Follow another user using screen_name" do
124 user = insert(:user)
125 followed = insert(:user)
126
127 {:ok, user, followed, _activity} =
128 TwitterAPI.follow(user, %{"screen_name" => followed.nickname})
129
130 assert User.ap_followers(followed) in user.following
131
132 followed = User.get_cached_by_ap_id(followed.ap_id)
133 assert followed.info.follower_count == 1
134
135 {:error, msg} = TwitterAPI.follow(user, %{"screen_name" => followed.nickname})
136 assert msg == "Could not follow user: #{followed.nickname} is already on your list."
137 end
138
139 test "Unfollow another user using user_id" do
140 unfollowed = insert(:user)
141 user = insert(:user, %{following: [User.ap_followers(unfollowed)]})
142 ActivityPub.follow(user, unfollowed)
143
144 {:ok, user, unfollowed} = TwitterAPI.unfollow(user, %{"user_id" => unfollowed.id})
145 assert user.following == []
146
147 {:error, msg} = TwitterAPI.unfollow(user, %{"user_id" => unfollowed.id})
148 assert msg == "Not subscribed!"
149 end
150
151 test "Unfollow another user using screen_name" do
152 unfollowed = insert(:user)
153 user = insert(:user, %{following: [User.ap_followers(unfollowed)]})
154
155 ActivityPub.follow(user, unfollowed)
156
157 {:ok, user, unfollowed} = TwitterAPI.unfollow(user, %{"screen_name" => unfollowed.nickname})
158 assert user.following == []
159
160 {:error, msg} = TwitterAPI.unfollow(user, %{"screen_name" => unfollowed.nickname})
161 assert msg == "Not subscribed!"
162 end
163
164 test "Block another user using user_id" do
165 user = insert(:user)
166 blocked = insert(:user)
167
168 {:ok, user, blocked} = TwitterAPI.block(user, %{"user_id" => blocked.id})
169 assert User.blocks?(user, blocked)
170 end
171
172 test "Block another user using screen_name" do
173 user = insert(:user)
174 blocked = insert(:user)
175
176 {:ok, user, blocked} = TwitterAPI.block(user, %{"screen_name" => blocked.nickname})
177 assert User.blocks?(user, blocked)
178 end
179
180 test "Unblock another user using user_id" do
181 unblocked = insert(:user)
182 user = insert(:user)
183 {:ok, user, _unblocked} = TwitterAPI.block(user, %{"user_id" => unblocked.id})
184
185 {:ok, user, _unblocked} = TwitterAPI.unblock(user, %{"user_id" => unblocked.id})
186 assert user.info.blocks == []
187 end
188
189 test "Unblock another user using screen_name" do
190 unblocked = insert(:user)
191 user = insert(:user)
192 {:ok, user, _unblocked} = TwitterAPI.block(user, %{"screen_name" => unblocked.nickname})
193
194 {:ok, user, _unblocked} = TwitterAPI.unblock(user, %{"screen_name" => unblocked.nickname})
195 assert user.info.blocks == []
196 end
197
198 test "upload a file" do
199 user = insert(:user)
200
201 file = %Plug.Upload{
202 content_type: "image/jpg",
203 path: Path.absname("test/fixtures/image.jpg"),
204 filename: "an_image.jpg"
205 }
206
207 response = TwitterAPI.upload(file, user)
208
209 assert is_binary(response)
210 end
211
212 test "it favorites a status, returns the updated activity" do
213 user = insert(:user)
214 other_user = insert(:user)
215 note_activity = insert(:note_activity)
216
217 {:ok, status} = TwitterAPI.fav(user, note_activity.id)
218 updated_activity = Activity.get_by_ap_id(note_activity.data["id"])
219 assert ActivityView.render("activity.json", %{activity: updated_activity})["fave_num"] == 1
220
221 object = Object.normalize(note_activity.data["object"])
222
223 assert object.data["like_count"] == 1
224
225 assert status == updated_activity
226
227 {:ok, _status} = TwitterAPI.fav(other_user, note_activity.id)
228
229 object = Object.normalize(note_activity.data["object"])
230
231 assert object.data["like_count"] == 2
232
233 updated_activity = Activity.get_by_ap_id(note_activity.data["id"])
234 assert ActivityView.render("activity.json", %{activity: updated_activity})["fave_num"] == 2
235 end
236
237 test "it unfavorites a status, returns the updated activity" do
238 user = insert(:user)
239 note_activity = insert(:note_activity)
240 object = Object.get_by_ap_id(note_activity.data["object"]["id"])
241
242 {:ok, _like_activity, _object} = ActivityPub.like(user, object)
243 updated_activity = Activity.get_by_ap_id(note_activity.data["id"])
244
245 assert ActivityView.render("activity.json", activity: updated_activity)["fave_num"] == 1
246
247 {:ok, activity} = TwitterAPI.unfav(user, note_activity.id)
248
249 assert ActivityView.render("activity.json", activity: activity)["fave_num"] == 0
250 end
251
252 test "it retweets a status and returns the retweet" do
253 user = insert(:user)
254 note_activity = insert(:note_activity)
255
256 {:ok, status} = TwitterAPI.repeat(user, note_activity.id)
257 updated_activity = Activity.get_by_ap_id(note_activity.data["id"])
258
259 assert status == updated_activity
260 end
261
262 test "it unretweets an already retweeted status" do
263 user = insert(:user)
264 note_activity = insert(:note_activity)
265
266 {:ok, _status} = TwitterAPI.repeat(user, note_activity.id)
267 {:ok, status} = TwitterAPI.unrepeat(user, note_activity.id)
268 updated_activity = Activity.get_by_ap_id(note_activity.data["id"])
269
270 assert status == updated_activity
271 end
272
273 test "it registers a new user and returns the user." do
274 data = %{
275 "nickname" => "lain",
276 "email" => "lain@wired.jp",
277 "fullname" => "lain iwakura",
278 "password" => "bear",
279 "confirm" => "bear"
280 }
281
282 {:ok, user} = TwitterAPI.register_user(data)
283
284 fetched_user = User.get_cached_by_nickname("lain")
285
286 assert UserView.render("show.json", %{user: user}) ==
287 UserView.render("show.json", %{user: fetched_user})
288 end
289
290 test "it registers a new user with empty string in bio and returns the user." do
291 data = %{
292 "nickname" => "lain",
293 "email" => "lain@wired.jp",
294 "fullname" => "lain iwakura",
295 "bio" => "",
296 "password" => "bear",
297 "confirm" => "bear"
298 }
299
300 {:ok, user} = TwitterAPI.register_user(data)
301
302 fetched_user = User.get_cached_by_nickname("lain")
303
304 assert UserView.render("show.json", %{user: user}) ==
305 UserView.render("show.json", %{user: fetched_user})
306 end
307
308 test "it sends confirmation email if :account_activation_required is specified in instance config" do
309 setting = Pleroma.Config.get([:instance, :account_activation_required])
310
311 unless setting do
312 Pleroma.Config.put([:instance, :account_activation_required], true)
313 on_exit(fn -> Pleroma.Config.put([:instance, :account_activation_required], setting) end)
314 end
315
316 data = %{
317 "nickname" => "lain",
318 "email" => "lain@wired.jp",
319 "fullname" => "lain iwakura",
320 "bio" => "",
321 "password" => "bear",
322 "confirm" => "bear"
323 }
324
325 {:ok, user} = TwitterAPI.register_user(data)
326
327 assert user.info.confirmation_pending
328
329 email = Pleroma.Emails.UserEmail.account_confirmation_email(user)
330
331 notify_email = Pleroma.Config.get([:instance, :notify_email])
332 instance_name = Pleroma.Config.get([:instance, :name])
333
334 Swoosh.TestAssertions.assert_email_sent(
335 from: {instance_name, notify_email},
336 to: {user.name, user.email},
337 html_body: email.html_body
338 )
339 end
340
341 test "it registers a new user and parses mentions in the bio" do
342 data1 = %{
343 "nickname" => "john",
344 "email" => "john@gmail.com",
345 "fullname" => "John Doe",
346 "bio" => "test",
347 "password" => "bear",
348 "confirm" => "bear"
349 }
350
351 {:ok, user1} = TwitterAPI.register_user(data1)
352
353 data2 = %{
354 "nickname" => "lain",
355 "email" => "lain@wired.jp",
356 "fullname" => "lain iwakura",
357 "bio" => "@john test",
358 "password" => "bear",
359 "confirm" => "bear"
360 }
361
362 {:ok, user2} = TwitterAPI.register_user(data2)
363
364 expected_text =
365 "<span class='h-card'><a data-user='#{user1.id}' class='u-url mention' href='#{user1.ap_id}'>@<span>john</span></a></span> test"
366
367 assert user2.bio == expected_text
368 end
369
370 describe "register with one time token" do
371 setup do
372 setting = Pleroma.Config.get([:instance, :registrations_open])
373
374 if setting do
375 Pleroma.Config.put([:instance, :registrations_open], false)
376 on_exit(fn -> Pleroma.Config.put([:instance, :registrations_open], setting) end)
377 end
378
379 :ok
380 end
381
382 test "returns user on success" do
383 {:ok, invite} = UserInviteToken.create_invite()
384
385 data = %{
386 "nickname" => "vinny",
387 "email" => "pasta@pizza.vs",
388 "fullname" => "Vinny Vinesauce",
389 "bio" => "streamer",
390 "password" => "hiptofbees",
391 "confirm" => "hiptofbees",
392 "token" => invite.token
393 }
394
395 {:ok, user} = TwitterAPI.register_user(data)
396
397 fetched_user = User.get_cached_by_nickname("vinny")
398 invite = Repo.get_by(UserInviteToken, token: invite.token)
399
400 assert invite.used == true
401
402 assert UserView.render("show.json", %{user: user}) ==
403 UserView.render("show.json", %{user: fetched_user})
404 end
405
406 test "returns error on invalid token" do
407 data = %{
408 "nickname" => "GrimReaper",
409 "email" => "death@reapers.afterlife",
410 "fullname" => "Reaper Grim",
411 "bio" => "Your time has come",
412 "password" => "scythe",
413 "confirm" => "scythe",
414 "token" => "DudeLetMeInImAFairy"
415 }
416
417 {:error, msg} = TwitterAPI.register_user(data)
418
419 assert msg == "Invalid token"
420 refute User.get_cached_by_nickname("GrimReaper")
421 end
422
423 test "returns error on expired token" do
424 {:ok, invite} = UserInviteToken.create_invite()
425 UserInviteToken.update_invite!(invite, used: true)
426
427 data = %{
428 "nickname" => "GrimReaper",
429 "email" => "death@reapers.afterlife",
430 "fullname" => "Reaper Grim",
431 "bio" => "Your time has come",
432 "password" => "scythe",
433 "confirm" => "scythe",
434 "token" => invite.token
435 }
436
437 {:error, msg} = TwitterAPI.register_user(data)
438
439 assert msg == "Expired token"
440 refute User.get_cached_by_nickname("GrimReaper")
441 end
442 end
443
444 describe "registers with date limited token" do
445 setup do
446 setting = Pleroma.Config.get([:instance, :registrations_open])
447
448 if setting do
449 Pleroma.Config.put([:instance, :registrations_open], false)
450 on_exit(fn -> Pleroma.Config.put([:instance, :registrations_open], setting) end)
451 end
452
453 data = %{
454 "nickname" => "vinny",
455 "email" => "pasta@pizza.vs",
456 "fullname" => "Vinny Vinesauce",
457 "bio" => "streamer",
458 "password" => "hiptofbees",
459 "confirm" => "hiptofbees"
460 }
461
462 check_fn = fn invite ->
463 data = Map.put(data, "token", invite.token)
464 {:ok, user} = TwitterAPI.register_user(data)
465 fetched_user = User.get_cached_by_nickname("vinny")
466
467 assert UserView.render("show.json", %{user: user}) ==
468 UserView.render("show.json", %{user: fetched_user})
469 end
470
471 {:ok, data: data, check_fn: check_fn}
472 end
473
474 test "returns user on success", %{check_fn: check_fn} do
475 {:ok, invite} = UserInviteToken.create_invite(%{expires_at: Date.utc_today()})
476
477 check_fn.(invite)
478
479 invite = Repo.get_by(UserInviteToken, token: invite.token)
480
481 refute invite.used
482 end
483
484 test "returns user on token which expired tomorrow", %{check_fn: check_fn} do
485 {:ok, invite} = UserInviteToken.create_invite(%{expires_at: Date.add(Date.utc_today(), 1)})
486
487 check_fn.(invite)
488
489 invite = Repo.get_by(UserInviteToken, token: invite.token)
490
491 refute invite.used
492 end
493
494 test "returns an error on overdue date", %{data: data} do
495 {:ok, invite} = UserInviteToken.create_invite(%{expires_at: Date.add(Date.utc_today(), -1)})
496
497 data = Map.put(data, "token", invite.token)
498
499 {:error, msg} = TwitterAPI.register_user(data)
500
501 assert msg == "Expired token"
502 refute User.get_cached_by_nickname("vinny")
503 invite = Repo.get_by(UserInviteToken, token: invite.token)
504
505 refute invite.used
506 end
507 end
508
509 describe "registers with reusable token" do
510 setup do
511 setting = Pleroma.Config.get([:instance, :registrations_open])
512
513 if setting do
514 Pleroma.Config.put([:instance, :registrations_open], false)
515 on_exit(fn -> Pleroma.Config.put([:instance, :registrations_open], setting) end)
516 end
517
518 :ok
519 end
520
521 test "returns user on success, after him registration fails" do
522 {:ok, invite} = UserInviteToken.create_invite(%{max_use: 100})
523
524 UserInviteToken.update_invite!(invite, uses: 99)
525
526 data = %{
527 "nickname" => "vinny",
528 "email" => "pasta@pizza.vs",
529 "fullname" => "Vinny Vinesauce",
530 "bio" => "streamer",
531 "password" => "hiptofbees",
532 "confirm" => "hiptofbees",
533 "token" => invite.token
534 }
535
536 {:ok, user} = TwitterAPI.register_user(data)
537 fetched_user = User.get_cached_by_nickname("vinny")
538 invite = Repo.get_by(UserInviteToken, token: invite.token)
539
540 assert invite.used == true
541
542 assert UserView.render("show.json", %{user: user}) ==
543 UserView.render("show.json", %{user: fetched_user})
544
545 data = %{
546 "nickname" => "GrimReaper",
547 "email" => "death@reapers.afterlife",
548 "fullname" => "Reaper Grim",
549 "bio" => "Your time has come",
550 "password" => "scythe",
551 "confirm" => "scythe",
552 "token" => invite.token
553 }
554
555 {:error, msg} = TwitterAPI.register_user(data)
556
557 assert msg == "Expired token"
558 refute User.get_cached_by_nickname("GrimReaper")
559 end
560 end
561
562 describe "registers with reusable date limited token" do
563 setup do
564 setting = Pleroma.Config.get([:instance, :registrations_open])
565
566 if setting do
567 Pleroma.Config.put([:instance, :registrations_open], false)
568 on_exit(fn -> Pleroma.Config.put([:instance, :registrations_open], setting) end)
569 end
570
571 :ok
572 end
573
574 test "returns user on success" do
575 {:ok, invite} = UserInviteToken.create_invite(%{expires_at: Date.utc_today(), max_use: 100})
576
577 data = %{
578 "nickname" => "vinny",
579 "email" => "pasta@pizza.vs",
580 "fullname" => "Vinny Vinesauce",
581 "bio" => "streamer",
582 "password" => "hiptofbees",
583 "confirm" => "hiptofbees",
584 "token" => invite.token
585 }
586
587 {:ok, user} = TwitterAPI.register_user(data)
588 fetched_user = User.get_cached_by_nickname("vinny")
589 invite = Repo.get_by(UserInviteToken, token: invite.token)
590
591 refute invite.used
592
593 assert UserView.render("show.json", %{user: user}) ==
594 UserView.render("show.json", %{user: fetched_user})
595 end
596
597 test "error after max uses" do
598 {:ok, invite} = UserInviteToken.create_invite(%{expires_at: Date.utc_today(), max_use: 100})
599
600 UserInviteToken.update_invite!(invite, uses: 99)
601
602 data = %{
603 "nickname" => "vinny",
604 "email" => "pasta@pizza.vs",
605 "fullname" => "Vinny Vinesauce",
606 "bio" => "streamer",
607 "password" => "hiptofbees",
608 "confirm" => "hiptofbees",
609 "token" => invite.token
610 }
611
612 {:ok, user} = TwitterAPI.register_user(data)
613 fetched_user = User.get_cached_by_nickname("vinny")
614 invite = Repo.get_by(UserInviteToken, token: invite.token)
615 assert invite.used == true
616
617 assert UserView.render("show.json", %{user: user}) ==
618 UserView.render("show.json", %{user: fetched_user})
619
620 data = %{
621 "nickname" => "GrimReaper",
622 "email" => "death@reapers.afterlife",
623 "fullname" => "Reaper Grim",
624 "bio" => "Your time has come",
625 "password" => "scythe",
626 "confirm" => "scythe",
627 "token" => invite.token
628 }
629
630 {:error, msg} = TwitterAPI.register_user(data)
631
632 assert msg == "Expired token"
633 refute User.get_cached_by_nickname("GrimReaper")
634 end
635
636 test "returns error on overdue date" do
637 {:ok, invite} =
638 UserInviteToken.create_invite(%{expires_at: Date.add(Date.utc_today(), -1), max_use: 100})
639
640 data = %{
641 "nickname" => "GrimReaper",
642 "email" => "death@reapers.afterlife",
643 "fullname" => "Reaper Grim",
644 "bio" => "Your time has come",
645 "password" => "scythe",
646 "confirm" => "scythe",
647 "token" => invite.token
648 }
649
650 {:error, msg} = TwitterAPI.register_user(data)
651
652 assert msg == "Expired token"
653 refute User.get_cached_by_nickname("GrimReaper")
654 end
655
656 test "returns error on with overdue date and after max" do
657 {:ok, invite} =
658 UserInviteToken.create_invite(%{expires_at: Date.add(Date.utc_today(), -1), max_use: 100})
659
660 UserInviteToken.update_invite!(invite, uses: 100)
661
662 data = %{
663 "nickname" => "GrimReaper",
664 "email" => "death@reapers.afterlife",
665 "fullname" => "Reaper Grim",
666 "bio" => "Your time has come",
667 "password" => "scythe",
668 "confirm" => "scythe",
669 "token" => invite.token
670 }
671
672 {:error, msg} = TwitterAPI.register_user(data)
673
674 assert msg == "Expired token"
675 refute User.get_cached_by_nickname("GrimReaper")
676 end
677 end
678
679 test "it returns the error on registration problems" do
680 data = %{
681 "nickname" => "lain",
682 "email" => "lain@wired.jp",
683 "fullname" => "lain iwakura",
684 "bio" => "close the world.",
685 "password" => "bear"
686 }
687
688 {:error, error_object} = TwitterAPI.register_user(data)
689
690 assert is_binary(error_object[:error])
691 refute User.get_cached_by_nickname("lain")
692 end
693
694 test "it assigns an integer conversation_id" do
695 note_activity = insert(:note_activity)
696 status = ActivityView.render("activity.json", activity: note_activity)
697
698 assert is_number(status["statusnet_conversation_id"])
699 end
700
701 setup do
702 Supervisor.terminate_child(Pleroma.Supervisor, Cachex)
703 Supervisor.restart_child(Pleroma.Supervisor, Cachex)
704 :ok
705 end
706
707 describe "fetching a user by uri" do
708 test "fetches a user by uri" do
709 id = "https://mastodon.social/users/lambadalambda"
710 user = insert(:user)
711 {:ok, represented} = TwitterAPI.get_external_profile(user, id)
712 remote = User.get_cached_by_ap_id(id)
713
714 assert represented["id"] == UserView.render("show.json", %{user: remote, for: user})["id"]
715
716 # Also fetches the feed.
717 # assert Activity.get_create_by_object_ap_id("tag:mastodon.social,2017-04-05:objectId=1641750:objectType=Status")
718 # credo:disable-for-previous-line Credo.Check.Readability.MaxLineLength
719 end
720 end
721 end