projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use named binding to conditionally join object
[akkoma]
/
test
/
tasks
/
user_test.exs
diff --git
a/test/tasks/user_test.exs
b/test/tasks/user_test.exs
index bde8f421c90e35c8acd218bd0da647bc60ee0033..eaf4ecf8449bfe1881a1c99cae5d729d3f8c4e8d 100644
(file)
--- a/
test/tasks/user_test.exs
+++ b/
test/tasks/user_test.exs
@@
-50,7
+50,7
@@
defmodule Mix.Tasks.Pleroma.UserTest do
assert_received {:mix_shell, :info, [message]}
assert message =~ "created"
assert_received {:mix_shell, :info, [message]}
assert message =~ "created"
- user = User.get_by_nickname(unsaved.nickname)
+ user = User.get_
cached_
by_nickname(unsaved.nickname)
assert user.name == unsaved.name
assert user.email == unsaved.email
assert user.bio == unsaved.bio
assert user.name == unsaved.name
assert user.email == unsaved.email
assert user.bio == unsaved.bio
@@
-75,7
+75,7
@@
defmodule Mix.Tasks.Pleroma.UserTest do
assert_received {:mix_shell, :info, [message]}
assert message =~ "will not be created"
assert_received {:mix_shell, :info, [message]}
assert message =~ "will not be created"
- refute User.get_by_nickname(unsaved.nickname)
+ refute User.get_
cached_
by_nickname(unsaved.nickname)
end
end
end
end
@@
-88,7
+88,7
@@
defmodule Mix.Tasks.Pleroma.UserTest do
assert_received {:mix_shell, :info, [message]}
assert message =~ " deleted"
assert_received {:mix_shell, :info, [message]}
assert message =~ " deleted"
- user = User.get_by_nickname(user.nickname)
+ user = User.get_
cached_
by_nickname(user.nickname)
assert user.info.deactivated
end
assert user.info.deactivated
end
@@
-109,7
+109,7
@@
defmodule Mix.Tasks.Pleroma.UserTest do
assert_received {:mix_shell, :info, [message]}
assert message =~ " deactivated"
assert_received {:mix_shell, :info, [message]}
assert message =~ " deactivated"
- user = User.get_by_nickname(user.nickname)
+ user = User.get_
cached_
by_nickname(user.nickname)
assert user.info.deactivated
end
assert user.info.deactivated
end
@@
-121,7
+121,7
@@
defmodule Mix.Tasks.Pleroma.UserTest do
assert_received {:mix_shell, :info, [message]}
assert message =~ " activated"
assert_received {:mix_shell, :info, [message]}
assert message =~ " activated"
- user = User.get_by_nickname(user.nickname)
+ user = User.get_
cached_
by_nickname(user.nickname)
refute user.info.deactivated
end
refute user.info.deactivated
end
@@
-150,7
+150,7
@@
defmodule Mix.Tasks.Pleroma.UserTest do
assert_received {:mix_shell, :info, [message]}
assert message =~ "Successfully unsubscribed"
assert_received {:mix_shell, :info, [message]}
assert message =~ "Successfully unsubscribed"
- user = User.get_by_nickname(user.nickname)
+ user = User.get_
cached_
by_nickname(user.nickname)
assert Enum.empty?(user.following)
assert user.info.deactivated
end
assert Enum.empty?(user.following)
assert user.info.deactivated
end
@@
-178,7
+178,7
@@
defmodule Mix.Tasks.Pleroma.UserTest do
assert_received {:mix_shell, :info, [message]}
assert message =~ ~r/Admin status .* true/
assert_received {:mix_shell, :info, [message]}
assert message =~ ~r/Admin status .* true/
- user = User.get_by_nickname(user.nickname)
+ user = User.get_
cached_
by_nickname(user.nickname)
assert user.info.is_moderator
assert user.info.locked
assert user.info.is_admin
assert user.info.is_moderator
assert user.info.locked
assert user.info.is_admin
@@
-204,7
+204,7
@@
defmodule Mix.Tasks.Pleroma.UserTest do
assert_received {:mix_shell, :info, [message]}
assert message =~ ~r/Admin status .* false/
assert_received {:mix_shell, :info, [message]}
assert message =~ ~r/Admin status .* false/
- user = User.get_by_nickname(user.nickname)
+ user = User.get_
cached_
by_nickname(user.nickname)
refute user.info.is_moderator
refute user.info.locked
refute user.info.is_admin
refute user.info.is_moderator
refute user.info.locked
refute user.info.is_admin
@@
-248,11
+248,11
@@
defmodule Mix.Tasks.Pleroma.UserTest do
assert message =~ "Generated user invite token one time"
end
assert message =~ "Generated user invite token one time"
end
- test "token is generated with expire_at" do
+ test "token is generated with expire
s
_at" do
assert capture_io(fn ->
Mix.Tasks.Pleroma.User.run([
"invite",
assert capture_io(fn ->
Mix.Tasks.Pleroma.User.run([
"invite",
- "--expire
-date
",
+ "--expire
s-at
",
Date.to_string(Date.utc_today())
])
end)
Date.to_string(Date.utc_today())
])
end)
@@
-274,13
+274,13
@@
defmodule Mix.Tasks.Pleroma.UserTest do
assert message =~ "Generated user invite token reusable"
end
assert message =~ "Generated user invite token reusable"
end
- test "token is generated with max use and expire date" do
+ test "token is generated with max use and expire
s
date" do
assert capture_io(fn ->
Mix.Tasks.Pleroma.User.run([
"invite",
"--max-use",
"5",
assert capture_io(fn ->
Mix.Tasks.Pleroma.User.run([
"invite",
"--max-use",
"5",
- "--expire
-date
",
+ "--expire
s-at
",
Date.to_string(Date.utc_today())
])
end)
Date.to_string(Date.utc_today())
])
end)
@@
-290,18
+290,19
@@
defmodule Mix.Tasks.Pleroma.UserTest do
end
end
end
end
- describe "running invites
_list
" do
+ describe "running invites" do
test "invites are listed" do
{:ok, invite} = Pleroma.UserInviteToken.create_invite()
{:ok, invite2} =
test "invites are listed" do
{:ok, invite} = Pleroma.UserInviteToken.create_invite()
{:ok, invite2} =
- Pleroma.UserInviteToken.create_invite(%{expire_at: Date.utc_today(), max_use: 15})
+ Pleroma.UserInviteToken.create_invite(%{expire
s
_at: Date.utc_today(), max_use: 15})
- assert capture_io(fn ->
- Mix.Tasks.Pleroma.User.run([
- "invites_list"
- ])
- end)
+ # assert capture_io(fn ->
+ Mix.Tasks.Pleroma.User.run([
+ "invites"
+ ])
+
+ # end)
assert_received {:mix_shell, :info, [message]}
assert_received {:mix_shell, :info, [message2]}
assert_received {:mix_shell, :info, [message]}
assert_received {:mix_shell, :info, [message2]}
@@
-312,13
+313,13
@@
defmodule Mix.Tasks.Pleroma.UserTest do
end
end
end
end
- describe "running
invite revok
e" do
+ describe "running
revoke_invit
e" do
test "invite is revoked" do
test "invite is revoked" do
- {:ok, invite} = Pleroma.UserInviteToken.create_invite(%{expire_at: Date.utc_today()})
+ {:ok, invite} = Pleroma.UserInviteToken.create_invite(%{expire
s
_at: Date.utc_today()})
assert capture_io(fn ->
Mix.Tasks.Pleroma.User.run([
assert capture_io(fn ->
Mix.Tasks.Pleroma.User.run([
- "
invite_revok
e",
+ "
revoke_invit
e",
invite.token
])
end)
invite.token
])
end)