Allow to use Mix tasks inside Releases
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
committed by
prichier
parent
a269d77044
commit
01f746a5d2
@@ -48,7 +48,9 @@ defmodule Mix.Tasks.Mobilizon.ActorsTest do
|
||||
end
|
||||
|
||||
test "show non-existing actor" do
|
||||
assert_raise Mix.Error, "Error: No such actor", fn -> Show.run([@username]) end
|
||||
Show.run([@username])
|
||||
assert_received {:mix_shell, :error, [message]}
|
||||
assert message =~ "Error: No such actor"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,6 +9,7 @@ defmodule Mix.Tasks.Mobilizon.RelayTest do
|
||||
|
||||
alias Mobilizon.Actors
|
||||
alias Mobilizon.Actors.{Actor, Follower}
|
||||
alias Mix.Tasks.Mobilizon.Relay.{Follow, Unfollow}
|
||||
|
||||
alias Mobilizon.Federation.ActivityPub.Relay
|
||||
|
||||
@@ -17,7 +18,7 @@ defmodule Mix.Tasks.Mobilizon.RelayTest do
|
||||
use_cassette "relay/fetch_relay_follow" do
|
||||
target_instance = "mobilizon1.com"
|
||||
|
||||
Mix.Tasks.Mobilizon.Relay.run(["follow", target_instance])
|
||||
Follow.run([target_instance])
|
||||
|
||||
local_actor = Relay.get_actor()
|
||||
assert local_actor.url =~ "/relay"
|
||||
@@ -35,7 +36,7 @@ defmodule Mix.Tasks.Mobilizon.RelayTest do
|
||||
use_cassette "relay/fetch_relay_unfollow" do
|
||||
target_instance = "mobilizon1.com"
|
||||
|
||||
Mix.Tasks.Mobilizon.Relay.run(["follow", target_instance])
|
||||
Follow.run([target_instance])
|
||||
|
||||
%Actor{} = local_actor = Relay.get_actor()
|
||||
|
||||
@@ -44,7 +45,7 @@ defmodule Mix.Tasks.Mobilizon.RelayTest do
|
||||
|
||||
assert %Follower{} = Actors.is_following(local_actor, target_actor)
|
||||
|
||||
Mix.Tasks.Mobilizon.Relay.run(["unfollow", target_instance])
|
||||
Unfollow.run([target_instance])
|
||||
|
||||
refute Actors.is_following(local_actor, target_actor)
|
||||
end
|
||||
|
||||
@@ -42,9 +42,15 @@ defmodule Mix.Tasks.Mobilizon.UsersTest do
|
||||
test "create with already used email" do
|
||||
insert(:user, email: @email)
|
||||
|
||||
assert_raise Mix.Error, "User has not been created because of the above reason.", fn ->
|
||||
New.run([@email])
|
||||
end
|
||||
New.run([@email])
|
||||
# Debug message
|
||||
assert_received {:mix_shell, :error, [message]}
|
||||
|
||||
assert message =~
|
||||
"[email: {\"This email is already used.\", [constraint: :unique, constraint_name: \"users_email_index\"]}]"
|
||||
|
||||
assert_received {:mix_shell, :error, [message]}
|
||||
assert message =~ "User has not been created because of the above reason."
|
||||
end
|
||||
end
|
||||
|
||||
@@ -62,7 +68,9 @@ defmodule Mix.Tasks.Mobilizon.UsersTest do
|
||||
end
|
||||
|
||||
test "delete non-existing user" do
|
||||
assert_raise Mix.Error, "Error: No such user", fn -> Delete.run([@email, "-y"]) end
|
||||
Delete.run([@email, "-y"])
|
||||
assert_received {:mix_shell, :error, [message]}
|
||||
assert message =~ "Error: No such user"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -87,7 +95,9 @@ defmodule Mix.Tasks.Mobilizon.UsersTest do
|
||||
end
|
||||
|
||||
test "show non-existing user" do
|
||||
assert_raise Mix.Error, "Error: No such user", fn -> Show.run([@email]) end
|
||||
Show.run([@email])
|
||||
assert_received {:mix_shell, :error, [message]}
|
||||
assert message =~ "Error: No such user"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -160,11 +170,9 @@ defmodule Mix.Tasks.Mobilizon.UsersTest do
|
||||
end
|
||||
|
||||
test "enable and disable at the same time" do
|
||||
assert_raise Mix.Error,
|
||||
"Can't use both --enabled and --disable options at the same time.",
|
||||
fn ->
|
||||
Modify.run([@email, "--disable", "--enable"])
|
||||
end
|
||||
Modify.run([@email, "--disable", "--enable"])
|
||||
assert_received {:mix_shell, :error, [message]}
|
||||
assert message =~ "Can't use both --enabled and --disable options at the same time."
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user