From 3b9ba5e2de6848ef488daf4d63a3860bd17a7470 Mon Sep 17 00:00:00 2001 From: David Schultz Date: Tue, 28 Dec 2021 12:15:12 -0600 Subject: [PATCH] import getpass --- actions/create_email_account.py | 1 + tests/actions/test_create_email_account.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/actions/create_email_account.py b/actions/create_email_account.py index a2bcff84..8ca43e17 100644 --- a/actions/create_email_account.py +++ b/actions/create_email_account.py @@ -40,6 +40,7 @@ async def process(email_server, group_path, dryrun=False, keycloak_client=None): } script = f'''import subprocess +import getpass import logging import os logging.basicConfig(level={logger.getEffectiveLevel()}) diff --git a/tests/actions/test_create_email_account.py b/tests/actions/test_create_email_account.py index e426a808..5e5c928a 100644 --- a/tests/actions/test_create_email_account.py +++ b/tests/actions/test_create_email_account.py @@ -24,7 +24,7 @@ async def test_create(keycloak_bootstrap, patch_ssh_sudo): assert patch_ssh_sudo.call_args.args[0] == 'test.test.test' user_dict = {'testuser': {'canonical': 'first.last', 'uid': 1000, 'gid': 1000}} - assert json.loads(patch_ssh_sudo.call_args.args[1].split('\n')[5].split('=',1)[-1]) == user_dict + assert json.loads(patch_ssh_sudo.call_args.args[1].split('\n')[6].split('=',1)[-1]) == user_dict @pytest.mark.asyncio async def test_create_error_ssh(keycloak_bootstrap, patch_ssh_sudo): @@ -48,7 +48,7 @@ async def test_create_not_in_group(keycloak_bootstrap, patch_ssh_sudo): assert patch_ssh_sudo.call_args.args[0] == 'test.test.test' user_dict = {} - assert json.loads(patch_ssh_sudo.call_args.args[1].split('\n')[5].split('=',1)[-1]) == user_dict + assert json.loads(patch_ssh_sudo.call_args.args[1].split('\n')[6].split('=',1)[-1]) == user_dict @pytest.fixture @@ -73,4 +73,4 @@ async def test_listener_create(keycloak_bootstrap, tmp_path, listener, patch_ssh assert patch_ssh_sudo.call_args.args[0] == 'test.test.test' user_dict = {'testuser': {'canonical': 'first.last', 'uid': 1000, 'gid': 1000}} - assert json.loads(patch_ssh_sudo.call_args.args[1].split('\n')[5].split('=',1)[-1]) == user_dict + assert json.loads(patch_ssh_sudo.call_args.args[1].split('\n')[6].split('=',1)[-1]) == user_dict