Projet

Général

Profil

0001-tests_authentic-add-authenticators-manager-role-7086.patch

Valentin Deniaud, 31 octobre 2022 15:27

Télécharger (4,61 ko)

Voir les différences:

Subject: [PATCH] tests_authentic: add authenticators manager role (#70866)

 .../data_authentic_export_site.json           | 54 ++++++++++++++++++-
 tests_authentic/test_hobo_deploy.py           | 10 ++--
 2 files changed, 58 insertions(+), 6 deletions(-)
tests_authentic/data_authentic_export_site.json
303 303
                    },
304 304
                    "service": null,
305 305
                    "slug": "_a2-manager-of-users-default"
306
                },
307
                {
308
                    "name": "Authenticators - Collectivité par défaut",
309
                    "ou": {
310
                        "name": "Collectivité par défaut",
311
                        "slug": "default"
312
                    },
313
                    "service": null,
314
                    "slug": "_a2-manager-of-authenticators-default"
306 315
                }
307 316
            ],
308 317
            "permissions": [
......
537 546
            ],
538 547
            "service": null,
539 548
            "slug": "_a2-manager-of-users-default"
540
        }
549
        },
550
    {
551
        "description": "",
552
        "external_id": "",
553
        "name": "Authenticators - Collectivité par défaut",
554
        "ou": {
555
            "name": "Collectivité par défaut", "slug": "default"
556
        },
557
        "permissions": [
558
            {
559
                "operation": {
560
                    "slug": "admin"
561
                },
562
                "ou": {
563
                    "name": "Collectivité par défaut",
564
                    "slug": "default"
565
                },
566
                "target": {
567
                    "app_label": "authenticators",
568
                    "model": "baseauthenticator"
569
                },
570
                "target_ct": {
571
                    "app_label": "contenttypes",
572
                    "model": "contenttype"
573
                }
574
            },
575
            {
576
                "operation": {
577
                    "slug": "search"
578
                },
579
                "ou": null,
580
                "target": {
581
                    "name": "Collectivité par défaut",
582
                    "slug": "default"
583
                },
584
                "target_ct": {
585
                    "app_label": "a2_rbac",
586
                    "model": "organizationalunit"
587
                }
588
            }
589
        ],
590
        "service": null,
591
        "slug": "_a2-manager-of-authenticators-default"
592
    }
541 593
    ]
542 594
}
tests_authentic/test_hobo_deploy.py
450 450
        for meta, service in zip(metadatas, other_services):
451 451
            provider = LibertyProvider.objects.get(slug=service['slug'])
452 452
            assert provider.metadata == meta
453
        # Two services loaded roles.json, so there must be 5 roles associated
454
        # to their "ou" excluding their superuser role, 3 admin roles for users,
455
        # roles and services, and 2 loaded roles, petite enfance and état-civil
456
        assert Role.objects.filter(ou__isnull=False, service__isnull=True).count() == 10
453
        # Two services loaded roles.json, so there must be 6 roles associated
454
        # to their "ou" excluding their superuser role, 4 admin roles for users,
455
        # roles, services and authenticators, and 2 loaded roles, petite enfance and état-civil
456
        assert Role.objects.filter(ou__isnull=False, service__isnull=True).count() == 12
457 457
        for service_id in {s['service-id'] for s in other_services}:
458 458
            same_services = [s for s in other_services if s['service-id'] == service_id]
459 459
            for i, service in enumerate(same_services):
......
502 502
                    == 1
503 503
                )
504 504
                if service.get('template_name'):
505
                    assert Role.objects.filter(ou=provider.ou, service__isnull=True).count() == 5
505
                    assert Role.objects.filter(ou=provider.ou, service__isnull=True).count() == 6
506 506
                    assert (
507 507
                        Role.objects.filter(
508 508
                            ou=provider.ou, service__isnull=True, name='Service petite enfance'
509
-