1
0
Fork 0
mirror of https://framagit.org/framasoft/mobilizon.git synced 2024-12-23 08:22:50 +00:00
mobilizon/test/graphql/resolvers/config_test.exs

53 lines
1.4 KiB
Elixir
Raw Normal View History

2020-01-26 19:34:25 +00:00
defmodule Mobilizon.GraphQL.Resolvers.ConfigTest do
2020-01-26 20:36:50 +00:00
use Mobilizon.Web.ConnCase
alias Mobilizon.Actors
alias Mobilizon.Actors.Actor
2019-03-22 09:53:38 +00:00
2020-01-26 19:34:25 +00:00
alias Mobilizon.GraphQL.AbsintheHelpers
2019-03-22 09:53:38 +00:00
describe "Resolver: Get config" do
test "get_config/3 returns the instance config", context do
Cachex.clear("full_config")
Mobilizon.Config.clear_config_cache()
2019-03-22 09:53:38 +00:00
query = """
{
config {
name,
registrationsOpen
anonymous {
participation {
allowed,
validation {
email {
enabled,
confirmationRequired
}
}
},
actor_id
}
2019-03-22 09:53:38 +00:00
}
}
"""
res =
context.conn
|> AbsintheHelpers.graphql_query(query: query)
assert res["data"]["config"]["name"] == "Test instance"
assert res["data"]["config"]["registrationsOpen"] == true
assert res["data"]["config"]["anonymous"]["participation"]["validation"]["email"]["enabled"] ==
true
assert res["data"]["config"]["anonymous"]["participation"]["validation"]["email"][
"confirmationRequired"
] == true
2019-03-22 09:53:38 +00:00
{:ok, %Actor{id: actor_id}} = Actors.get_or_create_internal_actor("anonymous")
assert res["data"]["config"]["anonymous"]["actor_id"] == to_string(actor_id)
2019-03-22 09:53:38 +00:00
end
end
end