forked from potsda.mn/mobilizon
Handle trying to create a category if not loggedin
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
07b9676f0d
commit
74bc21fa2c
|
@ -34,4 +34,8 @@ defmodule MobilizonWeb.Resolvers.Category do
|
||||||
{:error, errors}
|
{:error, errors}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def create_category(_parent, %{title: title, picture: picture, description: description}, %{}) do
|
||||||
|
{:error, "You are not allowed to create a category if not connected"}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -56,5 +56,24 @@ defmodule MobilizonWeb.Resolvers.CategoryResolverTest do
|
||||||
|
|
||||||
# assert json_response(res, 200)["data"]["createCategory"]["title"] == "my category"
|
# assert json_response(res, 200)["data"]["createCategory"]["title"] == "my category"
|
||||||
# end
|
# end
|
||||||
|
|
||||||
|
# test "create_category/3 doesn't create a category if the user isn't logged in", %{conn: conn, actor: actor} do
|
||||||
|
# mutation = """
|
||||||
|
# mutation {
|
||||||
|
# createCategory(title: "my category", description: "my desc") {
|
||||||
|
# id,
|
||||||
|
# title,
|
||||||
|
# description,
|
||||||
|
# },
|
||||||
|
# }
|
||||||
|
# """
|
||||||
|
|
||||||
|
# res =
|
||||||
|
# conn
|
||||||
|
# |> post("/api", AbsintheHelpers.mutation_skeleton(mutation))
|
||||||
|
|
||||||
|
# assert hd(json_response(res, 200)["errors"])["message"] ==
|
||||||
|
# "You are not allowed to create a category if not connected"
|
||||||
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue