assert owned_list in lists_2
refute not_owned_list in lists_2
end
+
+ test "get ap_id by user nickname and list id" do
+ nickname = "foo"
+ list_id = 42
+
+ expected = Pleroma.Web.Endpoint.url() <> "/users/#{nickname}/lists/#{list_id}"
+
+ assert Pleroma.List.ap_id(%Pleroma.User{nickname: nickname}, list_id) == expected
+ assert Pleroma.List.ap_id({nickname, list_id}) == expected
+ end
+
+ test "get by ap_id" do
+ user = insert(:user)
+ {:ok, list} = Pleroma.List.create("foo", user)
+ ap_id = Pleroma.List.ap_id(user, list.id)
+
+ assert Pleroma.List.get_by_ap_id(ap_id) == list
+ end
+
+ test "memberships" do
+ user = insert(:user)
+ member = insert(:user)
+ {:ok, list} = Pleroma.List.create("foo", user)
+ {:ok, list} = Pleroma.List.follow(list, member)
+
+ list_ap_id = Pleroma.List.ap_id(user, list.id)
+
+ assert Pleroma.List.memberships(member) == [list_ap_id]
+ end
end
end
end
+ test "fetch_activities/2 returns activities addressed to a list " do
+ user = insert(:user)
+ member = insert(:user)
+ {:ok, list} = Pleroma.List.create("foo", user)
+ {:ok, list} = Pleroma.List.follow(list, member)
+
+ {:ok, activity} =
+ CommonAPI.post(user, %{"status" => "foobar", "visibility" => "list:#{list.id}"})
+
+ activity = Repo.preload(activity, :bookmark)
+
+ assert ActivityPub.fetch_activities([], %{"user" => user}) == [activity]
+ end
+
def data_uri do
File.read!("test/fixtures/avatar_data_uri")
end
assert modified["directMessage"] == true
end
+
+ test "it strips BCC field" do
+ user = insert(:user)
+ {:ok, list} = Pleroma.List.create("foo", user)
+
+ {:ok, activity} =
+ CommonAPI.post(user, %{"status" => "foobar", "visibility" => "list:#{list.id}"})
+
+ {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
+
+ assert is_nil(modified["bcc"])
+ end
end
describe "user upgrade" do
assert object.data["content"] == "<p><b>2hu</b></p>alert('xss')"
end
+
+ test "it allows to address a list" do
+ user = insert(:user)
+ {:ok, list} = Pleroma.List.create("foo", user)
+
+ list_ap_id = Pleroma.List.ap_id(user, list.id)
+
+ {:ok, activity} =
+ CommonAPI.post(user, %{"status" => "foobar", "visibility" => "list:#{list.id}"})
+
+ assert activity.data["bcc"] == [list_ap_id]
+ assert activity.recipients == [list_ap_id, user.ap_id]
+ end
end
describe "reactions" do