1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.CommonAPITest do
9 alias Pleroma.Conversation.Participation
12 alias Pleroma.Web.ActivityPub.ActivityPub
13 alias Pleroma.Web.ActivityPub.Transmogrifier
14 alias Pleroma.Web.ActivityPub.Visibility
15 alias Pleroma.Web.AdminAPI.AccountView
16 alias Pleroma.Web.CommonAPI
18 import Pleroma.Factory
21 require Pleroma.Constants
23 setup do: clear_config([:instance, :safe_dm_mentions])
24 setup do: clear_config([:instance, :limit])
25 setup do: clear_config([:instance, :max_pinned_statuses])
27 describe "posting chat messages" do
28 setup do: clear_config([:instance, :chat_limit])
30 test "it posts a chat message" do
31 author = insert(:user)
32 recipient = insert(:user)
35 CommonAPI.post_chat_message(
38 "a test message <script>alert('uuu')</script> :firefox:"
41 assert activity.data["type"] == "Create"
43 object = Object.normalize(activity)
45 assert object.data["type"] == "ChatMessage"
46 assert object.data["to"] == [recipient.ap_id]
48 assert object.data["content"] ==
49 "a test message <script>alert('uuu')</script> :firefox:"
51 assert object.data["emoji"] == %{
52 "firefox" => "http://localhost:4001/emoji/Firefox.gif"
55 assert Chat.get(author.id, recipient.ap_id)
56 assert Chat.get(recipient.id, author.ap_id)
59 test "it reject messages over the local limit" do
60 Pleroma.Config.put([:instance, :chat_limit], 2)
62 author = insert(:user)
63 recipient = insert(:user)
66 CommonAPI.post_chat_message(
72 assert message == :content_too_long
76 describe "deletion" do
77 test "it allows users to delete their posts" do
80 {:ok, post} = CommonAPI.post(user, %{"status" => "namu amida butsu"})
82 with_mock Pleroma.Web.Federator,
83 publish: fn _ -> nil end do
84 assert {:ok, delete} = CommonAPI.delete(post.id, user)
86 assert called(Pleroma.Web.Federator.publish(delete))
89 refute Activity.get_by_id(post.id)
92 test "it does not allow a user to delete their posts" do
94 other_user = insert(:user)
96 {:ok, post} = CommonAPI.post(user, %{"status" => "namu amida butsu"})
98 assert {:error, "Could not delete"} = CommonAPI.delete(post.id, other_user)
99 assert Activity.get_by_id(post.id)
102 test "it allows moderators to delete other user's posts" do
104 moderator = insert(:user, is_moderator: true)
106 {:ok, post} = CommonAPI.post(user, %{"status" => "namu amida butsu"})
108 assert {:ok, delete} = CommonAPI.delete(post.id, moderator)
111 refute Activity.get_by_id(post.id)
114 test "it allows admins to delete other user's posts" do
116 moderator = insert(:user, is_admin: true)
118 {:ok, post} = CommonAPI.post(user, %{"status" => "namu amida butsu"})
120 assert {:ok, delete} = CommonAPI.delete(post.id, moderator)
123 refute Activity.get_by_id(post.id)
126 test "superusers deleting non-local posts won't federate the delete" do
127 # This is the user of the ingested activity
131 ap_id: "http://mastodon.example.org/users/admin",
132 last_refreshed_at: NaiveDateTime.utc_now()
135 moderator = insert(:user, is_admin: true)
138 File.read!("test/fixtures/mastodon-post-activity.json")
141 {:ok, post} = Transmogrifier.handle_incoming(data)
143 with_mock Pleroma.Web.Federator,
144 publish: fn _ -> nil end do
145 assert {:ok, delete} = CommonAPI.delete(post.id, moderator)
147 refute called(Pleroma.Web.Federator.publish(:_))
150 refute Activity.get_by_id(post.id)
154 test "favoriting race condition" do
156 users_serial = insert_list(10, :user)
157 users = insert_list(10, :user)
159 {:ok, activity} = CommonAPI.post(user, %{"status" => "."})
162 |> Enum.map(fn user ->
163 CommonAPI.favorite(user, activity.id)
166 object = Object.get_by_ap_id(activity.data["object"])
167 assert object.data["like_count"] == 10
170 |> Enum.map(fn user ->
172 CommonAPI.favorite(user, activity.id)
175 |> Enum.map(&Task.await/1)
177 object = Object.get_by_ap_id(activity.data["object"])
178 assert object.data["like_count"] == 20
181 test "repeating race condition" do
183 users_serial = insert_list(10, :user)
184 users = insert_list(10, :user)
186 {:ok, activity} = CommonAPI.post(user, %{"status" => "."})
189 |> Enum.map(fn user ->
190 CommonAPI.repeat(activity.id, user)
193 object = Object.get_by_ap_id(activity.data["object"])
194 assert object.data["announcement_count"] == 10
197 |> Enum.map(fn user ->
199 CommonAPI.repeat(activity.id, user)
202 |> Enum.map(&Task.await/1)
204 object = Object.get_by_ap_id(activity.data["object"])
205 assert object.data["announcement_count"] == 20
208 test "when replying to a conversation / participation, it will set the correct context id even if no explicit reply_to is given" do
210 {:ok, activity} = CommonAPI.post(user, %{"status" => ".", "visibility" => "direct"})
212 [participation] = Participation.for_user(user)
215 CommonAPI.post(user, %{"status" => ".", "in_reply_to_conversation_id" => participation.id})
217 assert Visibility.is_direct?(convo_reply)
219 assert activity.data["context"] == convo_reply.data["context"]
222 test "when replying to a conversation / participation, it only mentions the recipients explicitly declared in the participation" do
224 jafnhar = insert(:user)
225 tridi = insert(:user)
228 CommonAPI.post(har, %{
229 "status" => "@#{jafnhar.nickname} hey",
230 "visibility" => "direct"
233 assert har.ap_id in activity.recipients
234 assert jafnhar.ap_id in activity.recipients
236 [participation] = Participation.for_user(har)
239 CommonAPI.post(har, %{
240 "status" => "I don't really like @#{tridi.nickname}",
241 "visibility" => "direct",
242 "in_reply_to_status_id" => activity.id,
243 "in_reply_to_conversation_id" => participation.id
246 assert har.ap_id in activity.recipients
247 assert jafnhar.ap_id in activity.recipients
248 refute tridi.ap_id in activity.recipients
251 test "with the safe_dm_mention option set, it does not mention people beyond the initial tags" do
253 jafnhar = insert(:user)
254 tridi = insert(:user)
256 Pleroma.Config.put([:instance, :safe_dm_mentions], true)
259 CommonAPI.post(har, %{
260 "status" => "@#{jafnhar.nickname} hey, i never want to see @#{tridi.nickname} again",
261 "visibility" => "direct"
264 refute tridi.ap_id in activity.recipients
265 assert jafnhar.ap_id in activity.recipients
268 test "it de-duplicates tags" do
270 {:ok, activity} = CommonAPI.post(user, %{"status" => "#2hu #2HU"})
272 object = Object.normalize(activity)
274 assert object.data["tag"] == ["2hu"]
277 test "it adds emoji in the object" do
279 {:ok, activity} = CommonAPI.post(user, %{"status" => ":firefox:"})
281 assert Object.normalize(activity).data["emoji"]["firefox"]
284 describe "posting" do
285 test "it supports explicit addressing" do
287 user_two = insert(:user)
288 user_three = insert(:user)
289 user_four = insert(:user)
292 CommonAPI.post(user, %{
294 "Hey, I think @#{user_three.nickname} is ugly. @#{user_four.nickname} is alright though.",
295 "to" => [user_two.nickname, user_four.nickname, "nonexistent"]
298 assert user.ap_id in activity.recipients
299 assert user_two.ap_id in activity.recipients
300 assert user_four.ap_id in activity.recipients
301 refute user_three.ap_id in activity.recipients
304 test "it filters out obviously bad tags when accepting a post as HTML" do
307 post = "<p><b>2hu</b></p><script>alert('xss')</script>"
310 CommonAPI.post(user, %{
312 "content_type" => "text/html"
315 object = Object.normalize(activity)
317 assert object.data["content"] == "<p><b>2hu</b></p>alert('xss')"
320 test "it filters out obviously bad tags when accepting a post as Markdown" do
323 post = "<p><b>2hu</b></p><script>alert('xss')</script>"
326 CommonAPI.post(user, %{
328 "content_type" => "text/markdown"
331 object = Object.normalize(activity)
333 assert object.data["content"] == "<p><b>2hu</b></p>alert('xss')"
336 test "it does not allow replies to direct messages that are not direct messages themselves" do
339 {:ok, activity} = CommonAPI.post(user, %{"status" => "suya..", "visibility" => "direct"})
342 CommonAPI.post(user, %{
343 "status" => "suya..",
344 "visibility" => "direct",
345 "in_reply_to_status_id" => activity.id
348 Enum.each(["public", "private", "unlisted"], fn visibility ->
349 assert {:error, "The message visibility must be direct"} =
350 CommonAPI.post(user, %{
351 "status" => "suya..",
352 "visibility" => visibility,
353 "in_reply_to_status_id" => activity.id
358 test "it allows to address a list" do
360 {:ok, list} = Pleroma.List.create("foo", user)
363 CommonAPI.post(user, %{"status" => "foobar", "visibility" => "list:#{list.id}"})
365 assert activity.data["bcc"] == [list.ap_id]
366 assert activity.recipients == [list.ap_id, user.ap_id]
367 assert activity.data["listMessage"] == list.ap_id
370 test "it returns error when status is empty and no attachments" do
373 assert {:error, "Cannot post an empty status without attachments"} =
374 CommonAPI.post(user, %{"status" => ""})
377 test "it validates character limits are correctly enforced" do
378 Pleroma.Config.put([:instance, :limit], 5)
382 assert {:error, "The status is over the character limit"} =
383 CommonAPI.post(user, %{"status" => "foobar"})
385 assert {:ok, activity} = CommonAPI.post(user, %{"status" => "12345"})
388 test "it can handle activities that expire" do
392 NaiveDateTime.utc_now()
393 |> NaiveDateTime.truncate(:second)
394 |> NaiveDateTime.add(1_000_000, :second)
396 assert {:ok, activity} =
397 CommonAPI.post(user, %{"status" => "chai", "expires_in" => 1_000_000})
399 assert expiration = Pleroma.ActivityExpiration.get_by_activity_id(activity.id)
400 assert expiration.scheduled_at == expires_at
404 describe "reactions" do
405 test "reacting to a status with an emoji" do
407 other_user = insert(:user)
409 {:ok, activity} = CommonAPI.post(other_user, %{"status" => "cofe"})
411 {:ok, reaction} = CommonAPI.react_with_emoji(activity.id, user, "👍")
413 assert reaction.data["actor"] == user.ap_id
414 assert reaction.data["content"] == "👍"
416 {:ok, activity} = CommonAPI.post(other_user, %{"status" => "cofe"})
418 {:error, _} = CommonAPI.react_with_emoji(activity.id, user, ".")
421 test "unreacting to a status with an emoji" do
423 other_user = insert(:user)
425 {:ok, activity} = CommonAPI.post(other_user, %{"status" => "cofe"})
426 {:ok, reaction} = CommonAPI.react_with_emoji(activity.id, user, "👍")
428 {:ok, unreaction} = CommonAPI.unreact_with_emoji(activity.id, user, "👍")
430 assert unreaction.data["type"] == "Undo"
431 assert unreaction.data["object"] == reaction.data["id"]
432 assert unreaction.local
435 test "repeating a status" do
437 other_user = insert(:user)
439 {:ok, activity} = CommonAPI.post(other_user, %{"status" => "cofe"})
441 {:ok, %Activity{}, _} = CommonAPI.repeat(activity.id, user)
444 test "can't repeat a repeat" do
446 other_user = insert(:user)
447 {:ok, activity} = CommonAPI.post(other_user, %{"status" => "cofe"})
449 {:ok, %Activity{} = announce, _} = CommonAPI.repeat(activity.id, other_user)
451 refute match?({:ok, %Activity{}, _}, CommonAPI.repeat(announce.id, user))
454 test "repeating a status privately" do
456 other_user = insert(:user)
458 {:ok, activity} = CommonAPI.post(other_user, %{"status" => "cofe"})
460 {:ok, %Activity{} = announce_activity, _} =
461 CommonAPI.repeat(activity.id, user, %{"visibility" => "private"})
463 assert Visibility.is_private?(announce_activity)
466 test "favoriting a status" do
468 other_user = insert(:user)
470 {:ok, post_activity} = CommonAPI.post(other_user, %{"status" => "cofe"})
472 {:ok, %Activity{data: data}} = CommonAPI.favorite(user, post_activity.id)
473 assert data["type"] == "Like"
474 assert data["actor"] == user.ap_id
475 assert data["object"] == post_activity.data["object"]
478 test "retweeting a status twice returns the status" do
480 other_user = insert(:user)
482 {:ok, activity} = CommonAPI.post(other_user, %{"status" => "cofe"})
483 {:ok, %Activity{} = announce, object} = CommonAPI.repeat(activity.id, user)
484 {:ok, ^announce, ^object} = CommonAPI.repeat(activity.id, user)
487 test "favoriting a status twice returns ok, but without the like activity" do
489 other_user = insert(:user)
491 {:ok, activity} = CommonAPI.post(other_user, %{"status" => "cofe"})
492 {:ok, %Activity{}} = CommonAPI.favorite(user, activity.id)
493 assert {:ok, :already_liked} = CommonAPI.favorite(user, activity.id)
497 describe "pinned statuses" do
499 Pleroma.Config.put([:instance, :max_pinned_statuses], 1)
502 {:ok, activity} = CommonAPI.post(user, %{"status" => "HI!!!"})
504 [user: user, activity: activity]
507 test "pin status", %{user: user, activity: activity} do
508 assert {:ok, ^activity} = CommonAPI.pin(activity.id, user)
511 user = refresh_record(user)
513 assert %User{pinned_activities: [^id]} = user
516 test "pin poll", %{user: user} do
518 CommonAPI.post(user, %{
519 "status" => "How is fediverse today?",
520 "poll" => %{"options" => ["Absolutely outstanding", "Not good"], "expires_in" => 20}
523 assert {:ok, ^activity} = CommonAPI.pin(activity.id, user)
526 user = refresh_record(user)
528 assert %User{pinned_activities: [^id]} = user
531 test "unlisted statuses can be pinned", %{user: user} do
532 {:ok, activity} = CommonAPI.post(user, %{"status" => "HI!!!", "visibility" => "unlisted"})
533 assert {:ok, ^activity} = CommonAPI.pin(activity.id, user)
536 test "only self-authored can be pinned", %{activity: activity} do
539 assert {:error, "Could not pin"} = CommonAPI.pin(activity.id, user)
542 test "max pinned statuses", %{user: user, activity: activity_one} do
543 {:ok, activity_two} = CommonAPI.post(user, %{"status" => "HI!!!"})
545 assert {:ok, ^activity_one} = CommonAPI.pin(activity_one.id, user)
547 user = refresh_record(user)
549 assert {:error, "You have already pinned the maximum number of statuses"} =
550 CommonAPI.pin(activity_two.id, user)
553 test "unpin status", %{user: user, activity: activity} do
554 {:ok, activity} = CommonAPI.pin(activity.id, user)
556 user = refresh_record(user)
560 assert match?({:ok, %{id: ^id}}, CommonAPI.unpin(activity.id, user))
562 user = refresh_record(user)
564 assert %User{pinned_activities: []} = user
567 test "should unpin when deleting a status", %{user: user, activity: activity} do
568 {:ok, activity} = CommonAPI.pin(activity.id, user)
570 user = refresh_record(user)
572 assert {:ok, _} = CommonAPI.delete(activity.id, user)
574 user = refresh_record(user)
576 assert %User{pinned_activities: []} = user
580 describe "mute tests" do
584 activity = insert(:note_activity)
586 [user: user, activity: activity]
589 test "add mute", %{user: user, activity: activity} do
590 {:ok, _} = CommonAPI.add_mute(user, activity)
591 assert CommonAPI.thread_muted?(user, activity)
594 test "remove mute", %{user: user, activity: activity} do
595 CommonAPI.add_mute(user, activity)
596 {:ok, _} = CommonAPI.remove_mute(user, activity)
597 refute CommonAPI.thread_muted?(user, activity)
600 test "check that mutes can't be duplicate", %{user: user, activity: activity} do
601 CommonAPI.add_mute(user, activity)
602 {:error, _} = CommonAPI.add_mute(user, activity)
606 describe "reports" do
607 test "creates a report" do
608 reporter = insert(:user)
609 target_user = insert(:user)
611 {:ok, activity} = CommonAPI.post(target_user, %{"status" => "foobar"})
613 reporter_ap_id = reporter.ap_id
614 target_ap_id = target_user.ap_id
615 activity_ap_id = activity.data["id"]
619 account_id: target_user.id,
621 status_ids: [activity.id]
626 "id" => activity_ap_id,
627 "content" => "foobar",
628 "published" => activity.object.data["published"],
629 "actor" => AccountView.render("show.json", %{user: target_user})
632 assert {:ok, flag_activity} = CommonAPI.report(reporter, report_data)
635 actor: ^reporter_ap_id,
638 "content" => ^comment,
639 "object" => [^target_ap_id, ^note_obj],
645 test "updates report state" do
646 [reporter, target_user] = insert_pair(:user)
647 activity = insert(:note_activity, user: target_user)
649 {:ok, %Activity{id: report_id}} =
650 CommonAPI.report(reporter, %{
651 account_id: target_user.id,
652 comment: "I feel offended",
653 status_ids: [activity.id]
656 {:ok, report} = CommonAPI.update_report_state(report_id, "resolved")
658 assert report.data["state"] == "resolved"
660 [reported_user, activity_id] = report.data["object"]
662 assert reported_user == target_user.ap_id
663 assert activity_id == activity.data["id"]
666 test "does not update report state when state is unsupported" do
667 [reporter, target_user] = insert_pair(:user)
668 activity = insert(:note_activity, user: target_user)
670 {:ok, %Activity{id: report_id}} =
671 CommonAPI.report(reporter, %{
672 account_id: target_user.id,
673 comment: "I feel offended",
674 status_ids: [activity.id]
677 assert CommonAPI.update_report_state(report_id, "test") == {:error, "Unsupported state"}
680 test "updates state of multiple reports" do
681 [reporter, target_user] = insert_pair(:user)
682 activity = insert(:note_activity, user: target_user)
684 {:ok, %Activity{id: first_report_id}} =
685 CommonAPI.report(reporter, %{
686 account_id: target_user.id,
687 comment: "I feel offended",
688 status_ids: [activity.id]
691 {:ok, %Activity{id: second_report_id}} =
692 CommonAPI.report(reporter, %{
693 account_id: target_user.id,
694 comment: "I feel very offended!",
695 status_ids: [activity.id]
699 CommonAPI.update_report_state([first_report_id, second_report_id], "resolved")
701 first_report = Activity.get_by_id(first_report_id)
702 second_report = Activity.get_by_id(second_report_id)
704 assert report_ids -- [first_report_id, second_report_id] == []
705 assert first_report.data["state"] == "resolved"
706 assert second_report.data["state"] == "resolved"
710 describe "reblog muting" do
712 muter = insert(:user)
714 muted = insert(:user)
716 [muter: muter, muted: muted]
719 test "add a reblog mute", %{muter: muter, muted: muted} do
720 {:ok, _reblog_mute} = CommonAPI.hide_reblogs(muter, muted)
722 assert User.showing_reblogs?(muter, muted) == false
725 test "remove a reblog mute", %{muter: muter, muted: muted} do
726 {:ok, _reblog_mute} = CommonAPI.hide_reblogs(muter, muted)
727 {:ok, _reblog_mute} = CommonAPI.show_reblogs(muter, muted)
729 assert User.showing_reblogs?(muter, muted) == true
733 describe "unfollow/2" do
734 test "also unsubscribes a user" do
735 [follower, followed] = insert_pair(:user)
736 {:ok, follower, followed, _} = CommonAPI.follow(follower, followed)
737 {:ok, _subscription} = User.subscribe(follower, followed)
739 assert User.subscribed_to?(follower, followed)
741 {:ok, follower} = CommonAPI.unfollow(follower, followed)
743 refute User.subscribed_to?(follower, followed)
746 test "cancels a pending follow for a local user" do
747 follower = insert(:user)
748 followed = insert(:user, locked: true)
750 assert {:ok, follower, followed, %{id: activity_id, data: %{"state" => "pending"}}} =
751 CommonAPI.follow(follower, followed)
753 assert User.get_follow_state(follower, followed) == :follow_pending
754 assert {:ok, follower} = CommonAPI.unfollow(follower, followed)
755 assert User.get_follow_state(follower, followed) == nil
757 assert %{id: ^activity_id, data: %{"state" => "cancelled"}} =
758 Pleroma.Web.ActivityPub.Utils.fetch_latest_follow(follower, followed)
763 "object" => %{"type" => "Follow", "state" => "cancelled"}
765 } = Pleroma.Web.ActivityPub.Utils.fetch_latest_undo(follower)
768 test "cancels a pending follow for a remote user" do
769 follower = insert(:user)
770 followed = insert(:user, locked: true, local: false, ap_enabled: true)
772 assert {:ok, follower, followed, %{id: activity_id, data: %{"state" => "pending"}}} =
773 CommonAPI.follow(follower, followed)
775 assert User.get_follow_state(follower, followed) == :follow_pending
776 assert {:ok, follower} = CommonAPI.unfollow(follower, followed)
777 assert User.get_follow_state(follower, followed) == nil
779 assert %{id: ^activity_id, data: %{"state" => "cancelled"}} =
780 Pleroma.Web.ActivityPub.Utils.fetch_latest_follow(follower, followed)
785 "object" => %{"type" => "Follow", "state" => "cancelled"}
787 } = Pleroma.Web.ActivityPub.Utils.fetch_latest_undo(follower)
791 describe "accept_follow_request/2" do
792 test "after acceptance, it sets all existing pending follow request states to 'accept'" do
793 user = insert(:user, locked: true)
794 follower = insert(:user)
795 follower_two = insert(:user)
797 {:ok, follow_activity} = ActivityPub.follow(follower, user)
798 {:ok, follow_activity_two} = ActivityPub.follow(follower, user)
799 {:ok, follow_activity_three} = ActivityPub.follow(follower_two, user)
801 assert follow_activity.data["state"] == "pending"
802 assert follow_activity_two.data["state"] == "pending"
803 assert follow_activity_three.data["state"] == "pending"
805 {:ok, _follower} = CommonAPI.accept_follow_request(follower, user)
807 assert Repo.get(Activity, follow_activity.id).data["state"] == "accept"
808 assert Repo.get(Activity, follow_activity_two.id).data["state"] == "accept"
809 assert Repo.get(Activity, follow_activity_three.id).data["state"] == "pending"
812 test "after rejection, it sets all existing pending follow request states to 'reject'" do
813 user = insert(:user, locked: true)
814 follower = insert(:user)
815 follower_two = insert(:user)
817 {:ok, follow_activity} = ActivityPub.follow(follower, user)
818 {:ok, follow_activity_two} = ActivityPub.follow(follower, user)
819 {:ok, follow_activity_three} = ActivityPub.follow(follower_two, user)
821 assert follow_activity.data["state"] == "pending"
822 assert follow_activity_two.data["state"] == "pending"
823 assert follow_activity_three.data["state"] == "pending"
825 {:ok, _follower} = CommonAPI.reject_follow_request(follower, user)
827 assert Repo.get(Activity, follow_activity.id).data["state"] == "reject"
828 assert Repo.get(Activity, follow_activity_two.id).data["state"] == "reject"
829 assert Repo.get(Activity, follow_activity_three.id).data["state"] == "pending"
832 test "doesn't create a following relationship if the corresponding follow request doesn't exist" do
833 user = insert(:user, locked: true)
834 not_follower = insert(:user)
835 CommonAPI.accept_follow_request(not_follower, user)
837 assert Pleroma.FollowingRelationship.following?(not_follower, user) == false
842 test "does not allow to vote twice" do
844 other_user = insert(:user)
847 CommonAPI.post(user, %{
848 "status" => "Am I cute?",
849 "poll" => %{"options" => ["Yes", "No"], "expires_in" => 20}
852 object = Object.normalize(activity)
854 {:ok, _, object} = CommonAPI.vote(other_user, object, [0])
856 assert {:error, "Already voted"} == CommonAPI.vote(other_user, object, [1])
860 describe "listen/2" do
861 test "returns a valid activity" do
865 CommonAPI.listen(user, %{
866 "title" => "lain radio episode 1",
867 "album" => "lain radio",
872 object = Object.normalize(activity)
874 assert object.data["title"] == "lain radio episode 1"
876 assert Visibility.get_visibility(activity) == "public"
879 test "respects visibility=private" do
883 CommonAPI.listen(user, %{
884 "title" => "lain radio episode 1",
885 "album" => "lain radio",
888 "visibility" => "private"
891 object = Object.normalize(activity)
893 assert object.data["title"] == "lain radio episode 1"
895 assert Visibility.get_visibility(activity) == "private"