From 128c439f541a7939619bc243d1d482199acdb875 Mon Sep 17 00:00:00 2001 From: Jon Hadfield Date: Sun, 26 Jun 2016 10:22:26 +0100 Subject: [PATCH] remove debug. --- lib/creds/cred_plan.py | 3 ++- tests/test_plan.py | 12 ++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/creds/cred_plan.py b/lib/creds/cred_plan.py index 6079dc5..48e2ae9 100644 --- a/lib/creds/cred_plan.py +++ b/lib/creds/cred_plan.py @@ -35,4 +35,5 @@ def execute_plan(plan=None): write_authorized_keys(task['proposed_user']) return command_output else: - print('Skipping') + # Skipping + pass diff --git a/tests/test_plan.py b/tests/test_plan.py index 10a3f54..7c109f1 100644 --- a/tests/test_plan.py +++ b/tests/test_plan.py @@ -44,10 +44,6 @@ def test_create_and_execute_plan_to_create_new_user(): User(name='testuserx1234', home_dir='/home/testuserx1234', shell='/bin/false', gid=59999, uid=59999, gecos='test user gecos', public_keys=public_keys)) plan = create_plan(existing_users=current_users, proposed_users=provided_users) - print( - ) - print('PLAN') - print(plan) assert len(plan) == 1 assert plan[0]['comparison_result']['state'] == 'missing' assert plan[0]['proposed_user'].name == "testuserx1234" @@ -62,7 +58,6 @@ def test_create_and_execute_plan_to_create_new_user(): execute_plan(plan=plan) current_users = Users.from_passwd() - print(current_users) plan = create_plan(existing_users=current_users, proposed_users=provided_users) assert plan[0]['comparison_result']['state'] == 'existing' delete_test_user_and_group() @@ -77,8 +72,6 @@ def test_create_and_execute_plan_to_create_identical_user(): plan = create_plan(existing_users=current_users, proposed_users=provided_users) execute_plan(plan=plan) current_users = Users.from_passwd() - print('PLAN 2 FOR EXISTING') - print() plan = create_plan(existing_users=current_users, proposed_users=provided_users) assert plan[0]['comparison_result']['state'] == 'existing' delete_test_user_and_group() @@ -126,11 +119,13 @@ def test_execute_plan_to_create_new_user_with_clashing_uid(): def test_execute_plan_to_update_existing_user(): """ Create a new user and then attempt to create another user with existing id """ create_test_user() + raw_public_key_2 = PUBLIC_KEYS[1].get('raw') + public_key_2 = PublicKey(raw=raw_public_key_2) current_users = Users.from_passwd() provided_users = list() provided_users.append( User(name='testuserx1234', uid=59998, gid=1, gecos='test user gecos update', home_dir='/tmp', - shell='/bin/false')) + shell='/bin/false', public_keys=[public_key_2])) plan = create_plan(existing_users=current_users, proposed_users=provided_users) assert plan[0]['proposed_user'].gecos == '\"test user gecos update\"' execute_plan(plan=plan) @@ -143,6 +138,7 @@ def test_execute_plan_to_update_existing_user(): assert updated_user[0].gecos == '\"test user gecos update\"' assert updated_user[0].home_dir == '/tmp' assert updated_user[0].shell == '/bin/false' + assert updated_user[0].public_keys[0].raw == six.text_type(PUBLIC_KEYS[1]['raw']) delete_test_user_and_group()