mobilizon/test/graphql/resolvers/config_test.exs

53 lines
1.4 KiB
Elixir
Raw Normal View History

2020-01-26 20:34:25 +01:00
defmodule Mobilizon.GraphQL.Resolvers.ConfigTest do
2020-01-26 21:36:50 +01:00
use Mobilizon.Web.ConnCase
alias Mobilizon.Actors
alias Mobilizon.Actors.Actor
2019-03-22 10:53:38 +01:00
2020-01-26 20:34:25 +01:00
alias Mobilizon.GraphQL.AbsintheHelpers
2019-03-22 10:53:38 +01: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 10:53:38 +01:00
query = """
{
config {
name,
registrationsOpen
anonymous {
participation {
allowed,
validation {
email {
enabled,
confirmationRequired
}
}
},
actor_id
}
2019-03-22 10:53:38 +01: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 10:53:38 +01: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 10:53:38 +01:00
end
end
end