320 |
320 |
assert authenticator.enabled is True
|
321 |
321 |
|
322 |
322 |
|
323 |
|
def test_cleanup_saml_authenticator_data_migration():
|
324 |
|
app = 'authentic2_auth_fedict'
|
325 |
|
migrate_from = [(app, '0002_auto_20220706_1712'), ('authentic2_auth_saml', '0002_auto_20220608_1559')]
|
326 |
|
migrate_to = [(app, '0003_auto_20220721_1724'), ('authentic2_auth_saml', '0002_auto_20220608_1559')]
|
327 |
|
|
328 |
|
executor = MigrationExecutor(connection)
|
329 |
|
old_apps = executor.loader.project_state(migrate_from).apps
|
330 |
|
executor.migrate(migrate_from)
|
331 |
|
SAMLAuthenticator = old_apps.get_model('authentic2_auth_saml', 'SAMLAuthenticator')
|
332 |
|
|
333 |
|
SAMLAuthenticator.objects.all().delete()
|
334 |
|
SAMLAuthenticator.objects.create(slug='0', enabled=False)
|
335 |
|
SAMLAuthenticator.objects.create(
|
336 |
|
slug='1', enabled=True, metadata_url='https://iamapps-public.belgium.be/saml/fas-metadata.xml'
|
337 |
|
)
|
338 |
|
SAMLAuthenticator.objects.create(
|
339 |
|
slug='2', enabled=False, metadata_url='https://iamapps-public.belgium.be/saml/fas-metadata.xml'
|
340 |
|
) # only this one should get deleted
|
341 |
|
|
342 |
|
executor = MigrationExecutor(connection)
|
343 |
|
executor.migrate(migrate_to)
|
344 |
|
executor.loader.build_graph()
|
345 |
|
new_apps = executor.loader.project_state(migrate_to).apps
|
346 |
|
SAMLAuthenticator = new_apps.get_model('authentic2_auth_saml', 'SAMLAuthenticator')
|
347 |
|
|
348 |
|
assert SAMLAuthenticator.objects.count() == 2
|
349 |
|
assert not SAMLAuthenticator.objects.filter(slug='2').exists()
|
350 |
|
|
351 |
|
|
352 |
323 |
def test_manager(app, admin):
|
353 |
324 |
resp = login(app, admin, path='/manage/authenticators/', index=0)
|
354 |
325 |
|
355 |
|
-
|