Skip to content

Commit

Permalink
remove debug.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonhadfield committed Jun 26, 2016
1 parent aae18f1 commit 128c439
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
3 changes: 2 additions & 1 deletion lib/creds/cred_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ def execute_plan(plan=None):
write_authorized_keys(task['proposed_user'])
return command_output
else:
print('Skipping')
# Skipping
pass
12 changes: 4 additions & 8 deletions tests/test_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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()
Expand All @@ -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()
Expand Down Expand Up @@ -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)
Expand All @@ -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()


Expand Down

0 comments on commit 128c439

Please sign in to comment.