diff options
Diffstat (limited to 'tests/integration_tests/bugs/test_gh671.py')
-rw-r--r-- | tests/integration_tests/bugs/test_gh671.py | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/tests/integration_tests/bugs/test_gh671.py b/tests/integration_tests/bugs/test_gh671.py index 5e90cdda..15f204ee 100644 --- a/tests/integration_tests/bugs/test_gh671.py +++ b/tests/integration_tests/bugs/test_gh671.py @@ -11,13 +11,13 @@ import pytest from tests.integration_tests.clouds import IntegrationCloud -OLD_PASSWORD = 'DoIM33tTheComplexityRequirements!??' -NEW_PASSWORD = 'DoIM33tTheComplexityRequirementsNow!??' +OLD_PASSWORD = "DoIM33tTheComplexityRequirements!??" +NEW_PASSWORD = "DoIM33tTheComplexityRequirementsNow!??" def _check_password(instance, unhashed_password): - shadow_password = instance.execute('getent shadow ubuntu').split(':')[1] - salt = shadow_password.rsplit('$', 1)[0] + shadow_password = instance.execute("getent shadow ubuntu").split(":")[1] + salt = shadow_password.rsplit("$", 1)[0] hashed_password = crypt.crypt(unhashed_password, salt) assert shadow_password == hashed_password @@ -26,29 +26,28 @@ def _check_password(instance, unhashed_password): @pytest.mark.sru_2020_11 def test_update_default_password(setup_image, session_cloud: IntegrationCloud): os_profile = { - 'os_profile': { - 'admin_password': '', - 'linux_configuration': { - 'disable_password_authentication': False - } + "os_profile": { + "admin_password": "", + "linux_configuration": {"disable_password_authentication": False}, } } - os_profile['os_profile']['admin_password'] = OLD_PASSWORD - instance1 = session_cloud.launch(launch_kwargs={'vm_params': os_profile}) + os_profile["os_profile"]["admin_password"] = OLD_PASSWORD + instance1 = session_cloud.launch(launch_kwargs={"vm_params": os_profile}) _check_password(instance1, OLD_PASSWORD) snapshot_id = instance1.cloud.cloud_instance.snapshot( - instance1.instance, - delete_provisioned_user=False + instance1.instance, delete_provisioned_user=False ) - os_profile['os_profile']['admin_password'] = NEW_PASSWORD + os_profile["os_profile"]["admin_password"] = NEW_PASSWORD try: - with session_cloud.launch(launch_kwargs={ - 'image_id': snapshot_id, - 'vm_params': os_profile, - }) as instance2: + with session_cloud.launch( + launch_kwargs={ + "image_id": snapshot_id, + "vm_params": os_profile, + } + ) as instance2: _check_password(instance2, NEW_PASSWORD) finally: session_cloud.cloud_instance.delete_image(snapshot_id) |