use Pleroma.Web.ConnCase
use Oban.Testing, repo: Pleroma.Repo
- alias Pleroma.Config
alias Pleroma.Tests.ObanHelpers
alias Pleroma.User
}
]
- Config.put(:frontend_configurations, config)
+ clear_config(:frontend_configurations, config)
response =
conn
setup do: clear_config([:instance, :healthcheck])
test "returns 503 when healthcheck disabled", %{conn: conn} do
- Config.put([:instance, :healthcheck], false)
+ clear_config([:instance, :healthcheck], false)
response =
conn
end
test "returns 200 when healthcheck enabled and all ok", %{conn: conn} do
- Config.put([:instance, :healthcheck], true)
+ clear_config([:instance, :healthcheck], true)
with_mock Pleroma.Healthcheck,
system_info: fn -> %Pleroma.Healthcheck{healthy: true} end do
end
test "returns 503 when healthcheck enabled and health is false", %{conn: conn} do
- Config.put([:instance, :healthcheck], true)
+ clear_config([:instance, :healthcheck], true)
with_mock Pleroma.Healthcheck,
system_info: fn -> %Pleroma.Healthcheck{healthy: false} end do
user = User.get_cached_by_id(user.id)
- assert user.deactivated == true
+ refute user.is_active
end
test "with valid permissions and invalid password, it returns an error", %{conn: conn} do
assert response == %{"error" => "Invalid password."}
user = User.get_cached_by_id(user.id)
- refute user.deactivated
+ assert user.is_active
end
end
assert json_response(conn, 200) == %{"status" => "success"}
user = User.get_by_id(user.id)
- assert user.deactivated == true
+ refute user.is_active
assert user.name == nil
assert user.bio == ""
assert user.password_hash == nil