Remove credo and use mix format, and lint everything
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -24,58 +24,63 @@ defmodule EventosWeb.UserControllerTest do
|
||||
describe "index" do
|
||||
test "lists all users", %{conn: conn, user: user} do
|
||||
conn = auth_conn(conn, user)
|
||||
conn = get conn, user_path(conn, :index)
|
||||
conn = get(conn, user_path(conn, :index))
|
||||
assert hd(json_response(conn, 200)["data"])["id"] == user.id
|
||||
end
|
||||
end
|
||||
|
||||
describe "create user" do
|
||||
test "renders user when data is valid", %{conn: conn} do
|
||||
conn = post conn, user_path(conn, :create), @create_attrs
|
||||
conn = post(conn, user_path(conn, :create), @create_attrs)
|
||||
assert %{"email" => "foo@bar.tld"} = json_response(conn, 201)
|
||||
end
|
||||
|
||||
test "renders errors when data is invalid", %{conn: conn} do
|
||||
conn = post conn, user_path(conn, :create), @invalid_attrs
|
||||
conn = post(conn, user_path(conn, :create), @invalid_attrs)
|
||||
assert json_response(conn, 422)["errors"] != %{}
|
||||
end
|
||||
|
||||
test "renders user with avatar when email is valid", %{conn: conn} do
|
||||
attrs = %{email: "contact@framasoft.org", password: "some password_hash", username: "framasoft"}
|
||||
conn = post conn, user_path(conn, :create), attrs
|
||||
attrs = %{
|
||||
email: "contact@framasoft.org",
|
||||
password: "some password_hash",
|
||||
username: "framasoft"
|
||||
}
|
||||
|
||||
conn = post(conn, user_path(conn, :create), attrs)
|
||||
assert %{"email" => "contact@framasoft.org"} = json_response(conn, 201)
|
||||
end
|
||||
end
|
||||
|
||||
# describe "update user" do
|
||||
# setup [:create_user]
|
||||
#
|
||||
# test "renders user when data is valid", %{conn: conn, user: %User{id: id} = user} do
|
||||
# conn = auth_conn(conn, user)
|
||||
# conn = put conn, user_path(conn, :update, user), user: @update_attrs
|
||||
# assert %{"id" => ^id} = json_response(conn, 200)["data"]
|
||||
#
|
||||
# conn = get conn, user_path(conn, :show, id)
|
||||
# assert json_response(conn, 200)["data"] == %{
|
||||
# "id" => id,
|
||||
# "email" => "some updated email",
|
||||
# "password_hash" => "some updated password_hash",
|
||||
# "role" => 43}
|
||||
# end
|
||||
#
|
||||
# test "renders errors when data is invalid", %{conn: conn, user: user} do
|
||||
# conn = auth_conn(conn, user)
|
||||
# conn = put conn, user_path(conn, :update, user), user: @invalid_attrs
|
||||
# assert json_response(conn, 422)["errors"] != %{}
|
||||
# end
|
||||
# end
|
||||
# describe "update user" do
|
||||
# setup [:create_user]
|
||||
#
|
||||
# test "renders user when data is valid", %{conn: conn, user: %User{id: id} = user} do
|
||||
# conn = auth_conn(conn, user)
|
||||
# conn = put conn, user_path(conn, :update, user), user: @update_attrs
|
||||
# assert %{"id" => ^id} = json_response(conn, 200)["data"]
|
||||
#
|
||||
# conn = get conn, user_path(conn, :show, id)
|
||||
# assert json_response(conn, 200)["data"] == %{
|
||||
# "id" => id,
|
||||
# "email" => "some updated email",
|
||||
# "password_hash" => "some updated password_hash",
|
||||
# "role" => 43}
|
||||
# end
|
||||
#
|
||||
# test "renders errors when data is invalid", %{conn: conn, user: user} do
|
||||
# conn = auth_conn(conn, user)
|
||||
# conn = put conn, user_path(conn, :update, user), user: @invalid_attrs
|
||||
# assert json_response(conn, 422)["errors"] != %{}
|
||||
# end
|
||||
# end
|
||||
|
||||
describe "delete user" do
|
||||
setup [:create_user]
|
||||
|
||||
test "deletes chosen user", %{conn: conn, user: user} do
|
||||
conn = auth_conn(conn, user)
|
||||
conn = delete conn, user_path(conn, :delete, user)
|
||||
conn = delete(conn, user_path(conn, :delete, user))
|
||||
assert response(conn, 204)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user