tests_authentic: add authenticators manager role (#70866)

This commit is contained in:
Valentin Deniaud 2022-10-31 15:26:44 +01:00
parent ec1e57177a
commit ccbac9a310
2 changed files with 102 additions and 6 deletions

View File

@ -68,6 +68,12 @@
"ou": null,
"service": null,
"slug": "_a2-manager-of-users"
},
{
"name": "Manager of authenticators",
"ou": null,
"service": null,
"slug": "_a2-manager-of-authenticators"
}
],
"permissions": [
@ -271,6 +277,44 @@
"service": null,
"slug": "_a2-manager-of-users"
},
{
"description": "",
"external_id": "",
"name": "Manager of authenticators",
"ou": null,
"permissions": [
{
"operation": {
"slug": "admin"
},
"ou": null,
"target": {
"app_label": "authenticators",
"model": "baseauthenticator"
},
"target_ct": {
"app_label": "contenttypes",
"model": "contenttype"
}
},
{
"operation": {
"slug": "search"
},
"ou": null,
"target": {
"app_label": "a2_rbac",
"model": "organizationalunit"
},
"target_ct": {
"app_label": "contenttypes",
"model": "contenttype"
}
}
],
"service": null,
"slug": "_a2-manager-of-authenticators"
},
{
"description": "",
"external_id": "",
@ -303,6 +347,15 @@
},
"service": null,
"slug": "_a2-manager-of-users-default"
},
{
"name": "Authenticators - Collectivité par défaut",
"ou": {
"name": "Collectivité par défaut",
"slug": "default"
},
"service": null,
"slug": "_a2-manager-of-authenticators-default"
}
],
"permissions": [
@ -537,6 +590,49 @@
],
"service": null,
"slug": "_a2-manager-of-users-default"
}
},
{
"description": "",
"external_id": "",
"name": "Authenticators - Collectivité par défaut",
"ou": {
"name": "Collectivité par défaut", "slug": "default"
},
"permissions": [
{
"operation": {
"slug": "admin"
},
"ou": {
"name": "Collectivité par défaut",
"slug": "default"
},
"target": {
"app_label": "authenticators",
"model": "baseauthenticator"
},
"target_ct": {
"app_label": "contenttypes",
"model": "contenttype"
}
},
{
"operation": {
"slug": "search"
},
"ou": null,
"target": {
"name": "Collectivité par défaut",
"slug": "default"
},
"target_ct": {
"app_label": "a2_rbac",
"model": "organizationalunit"
}
}
],
"service": null,
"slug": "_a2-manager-of-authenticators-default"
}
]
}

View File

@ -450,10 +450,10 @@ def test_hobo_deploy(monkeypatch, tenant_base, mocker, skeleton_dir, tmp_path):
for meta, service in zip(metadatas, other_services):
provider = LibertyProvider.objects.get(slug=service['slug'])
assert provider.metadata == meta
# Two services loaded roles.json, so there must be 5 roles associated
# to their "ou" excluding their superuser role, 3 admin roles for users,
# roles and services, and 2 loaded roles, petite enfance and état-civil
assert Role.objects.filter(ou__isnull=False, service__isnull=True).count() == 10
# Two services loaded roles.json, so there must be 6 roles associated
# to their "ou" excluding their superuser role, 4 admin roles for users,
# roles, services and authenticators, and 2 loaded roles, petite enfance and état-civil
assert Role.objects.filter(ou__isnull=False, service__isnull=True).count() == 12
for service_id in {s['service-id'] for s in other_services}:
same_services = [s for s in other_services if s['service-id'] == service_id]
for i, service in enumerate(same_services):
@ -502,7 +502,7 @@ def test_hobo_deploy(monkeypatch, tenant_base, mocker, skeleton_dir, tmp_path):
== 1
)
if service.get('template_name'):
assert Role.objects.filter(ou=provider.ou, service__isnull=True).count() == 5
assert Role.objects.filter(ou=provider.ou, service__isnull=True).count() == 6
assert (
Role.objects.filter(
ou=provider.ou, service__isnull=True, name='Service petite enfance'