Projet

Général

Profil

0001-auth_fc-set-authenticator-to-be-first-by-default-on-.patch

Valentin Deniaud, 20 juillet 2022 15:54

Télécharger (1,5 ko)

Voir les différences:

Subject: [PATCH] auth_fc: set authenticator to be first by default on creation
 (#66266)

 src/authentic2_auth_fc/models.py     | 5 +++++
 tests/test_manager_authenticators.py | 2 ++
 2 files changed, 7 insertions(+)
src/authentic2_auth_fc/models.py
83 83

  
84 84
        return FcAuthenticatorForm
85 85

  
86
    def save(self, *args, **kwargs):
87
        if not self.pk:
88
            self.order = -1
89
        return super().save(*args, **kwargs)
90

  
86 91
    def get_scopes_display(self):
87 92
        scope_dict = {k: v for k, v in SCOPE_CHOICES}
88 93
        return ', '.join(str(scope_dict[scope]) for scope in self.scopes)
tests/test_manager_authenticators.py
198 198
    assert '/edit/' in resp.location
199 199

  
200 200
    provider = FcAuthenticator.objects.get()
201
    assert provider.order == -1
202

  
201 203
    resp = app.get(provider.get_absolute_url())
202 204
    assert 'extra-actions-menu-opener' in resp.text
203 205
    assert 'Platform: Integration' in resp.text
204
-