1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 01:21:21 +03:00

Fix typo and update tests to catch other typos

This commit is contained in:
Wayne Witzel III 2017-06-12 14:14:07 -04:00
parent d1008e4ccd
commit af7762e417
3 changed files with 21 additions and 1 deletions

View File

@ -23,3 +23,8 @@ def test_settings():
assert setting.value.startswith('$encrypted$AESCBC$')
assert new_decrypt_field(setting, 'value') == 'test'
# This is here for a side-effect.
# Exception if the encryption type of AESCBC is not properly skipped, ensures
# our `startswith` calls don't have typos
replace_aesecb_fernet(apps, None)

View File

@ -15,7 +15,7 @@ def _notification_templates(apps):
for nt in NotificationTemplate.objects.all():
for field in filter(lambda x: nt.notification_class.init_parameters[x]['type'] == "password",
nt.notification_class.init_parameters):
if nt.notification_configuration[field].startswith('$encrypted$AESCBC4'):
if nt.notification_configuration[field].startswith('$encrypted$AESCBC$'):
continue
value = decrypt_field(nt, 'notification_configuration', subfield=field)
nt.notification_configuration[field] = value

View File

@ -35,6 +35,11 @@ def test_notification_template_migration():
assert nt.notification_configuration['token'].startswith('$encrypted$AESCBC$')
assert decrypt_field(nt, 'notification_configuration', subfield='token') == 'test'
# This is here for a side-effect.
# Exception if the encryption type of AESCBC is not properly skipped, ensures
# our `startswith` calls don't have typos
_notification_templates(apps)
@pytest.mark.django_db
def test_credential_migration():
@ -52,6 +57,11 @@ def test_credential_migration():
assert cred.password.startswith('$encrypted$AESCBC$')
assert decrypt_field(cred, 'password') == 'test'
# This is here for a side-effect.
# Exception if the encryption type of AESCBC is not properly skipped, ensures
# our `startswith` calls don't have typos
_credentials(apps)
@pytest.mark.django_db
def test_unified_job_migration():
@ -65,3 +75,8 @@ def test_unified_job_migration():
assert uj.start_args.startswith('$encrypted$AESCBC$')
assert json.loads(decrypt_field(uj, 'start_args')) == {'test':'value'}
# This is here for a side-effect.
# Exception if the encryption type of AESCBC is not properly skipped, ensures
# our `startswith` calls don't have typos
_unified_jobs(apps)