Merge branch 'develop' into conversations-import
This commit is contained in:
commit
ebb0482116
18 changed files with 216 additions and 63 deletions
|
|
@ -338,4 +338,31 @@ defmodule Mix.Tasks.Pleroma.UserTest do
|
|||
assert message == "User #{nickname} statuses deleted."
|
||||
end
|
||||
end
|
||||
|
||||
describe "running toggle_confirmed" do
|
||||
test "user is confirmed" do
|
||||
%{id: id, nickname: nickname} = insert(:user, info: %{confirmation_pending: false})
|
||||
|
||||
assert :ok = Mix.Tasks.Pleroma.User.run(["toggle_confirmed", nickname])
|
||||
assert_received {:mix_shell, :info, [message]}
|
||||
assert message == "#{nickname} needs confirmation."
|
||||
|
||||
user = Repo.get(User, id)
|
||||
assert user.info.confirmation_pending
|
||||
assert user.info.confirmation_token
|
||||
end
|
||||
|
||||
test "user is not confirmed" do
|
||||
%{id: id, nickname: nickname} =
|
||||
insert(:user, info: %{confirmation_pending: true, confirmation_token: "some token"})
|
||||
|
||||
assert :ok = Mix.Tasks.Pleroma.User.run(["toggle_confirmed", nickname])
|
||||
assert_received {:mix_shell, :info, [message]}
|
||||
assert message == "#{nickname} doesn't need confirmation."
|
||||
|
||||
user = Repo.get(User, id)
|
||||
refute user.info.confirmation_pending
|
||||
refute user.info.confirmation_token
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -873,7 +873,6 @@ defmodule Pleroma.UserTest do
|
|||
|
||||
assert [activity] ==
|
||||
ActivityPub.fetch_activities([user2.ap_id | user2.following], %{"user" => user2})
|
||||
|> ActivityPub.contain_timeline(user2)
|
||||
|
||||
{:ok, _user} = User.deactivate(user)
|
||||
|
||||
|
|
@ -882,7 +881,6 @@ defmodule Pleroma.UserTest do
|
|||
|
||||
assert [] ==
|
||||
ActivityPub.fetch_activities([user2.ap_id | user2.following], %{"user" => user2})
|
||||
|> ActivityPub.contain_timeline(user2)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -1204,4 +1202,22 @@ defmodule Pleroma.UserTest do
|
|||
|
||||
assert Map.get(user_show, "followers_count") == 2
|
||||
end
|
||||
|
||||
describe "toggle_confirmation/1" do
|
||||
test "if user is confirmed" do
|
||||
user = insert(:user, info: %{confirmation_pending: false})
|
||||
{:ok, user} = User.toggle_confirmation(user)
|
||||
|
||||
assert user.info.confirmation_pending
|
||||
assert user.info.confirmation_token
|
||||
end
|
||||
|
||||
test "if user is unconfirmed" do
|
||||
user = insert(:user, info: %{confirmation_pending: true, confirmation_token: "some token"})
|
||||
{:ok, user} = User.toggle_confirmation(user)
|
||||
|
||||
refute user.info.confirmation_pending
|
||||
refute user.info.confirmation_token
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -960,17 +960,21 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
|
|||
"in_reply_to_status_id" => private_activity_2.id
|
||||
})
|
||||
|
||||
activities = ActivityPub.fetch_activities([user1.ap_id | user1.following])
|
||||
activities =
|
||||
ActivityPub.fetch_activities([user1.ap_id | user1.following])
|
||||
|> Enum.map(fn a -> a.id end)
|
||||
|
||||
private_activity_1 = Activity.get_by_ap_id_with_object(private_activity_1.data["id"])
|
||||
|
||||
assert [public_activity, private_activity_1, private_activity_3] == activities
|
||||
assert [public_activity.id, private_activity_1.id, private_activity_3.id] == activities
|
||||
|
||||
assert length(activities) == 3
|
||||
|
||||
activities = ActivityPub.contain_timeline(activities, user1)
|
||||
activities =
|
||||
ActivityPub.fetch_activities([user1.ap_id | user1.following], %{"user" => user1})
|
||||
|> Enum.map(fn a -> a.id end)
|
||||
|
||||
assert [public_activity, private_activity_1] == activities
|
||||
assert [public_activity.id, private_activity_1.id] == activities
|
||||
assert length(activities) == 2
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue