1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-12-03 22:51:11 +03:00
Files
authentication-service/policies/register_test.rego
2022-06-03 13:37:20 +02:00

37 lines
889 B
Rego

package register
mock_user := {"username": "hello", "email": "hello@staging.element.io"}
test_allow_all_domains {
allow with input.user as mock_user
}
test_allowed_domain {
allow with input.user as mock_user
with data.allowed_domains as ["*.element.io"]
}
test_not_allowed_domain {
not allow with input.user as mock_user
with data.allowed_domains as ["example.com"]
}
test_banned_domain {
not allow with input.user as mock_user
with data.banned_domains as ["*.element.io"]
}
test_banned_subdomain {
not allow with input.user as mock_user
with data.allowed_domains as ["*.element.io"]
with data.banned_domains as ["staging.element.io"]
}
test_short_username {
not allow with input.user as {"username": "a", "email": "hello@element.io"}
}
test_long_username {
not allow with input.user as {"username": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "email": "hello@element.io"}
}