Code review comment for lp:~jamesbeedy/charm-helpers/add_uid_gid

Revision history for this message
Matt Bruzek (mbruzek) wrote :

When I tried to 'make test' many of the existing tests fail because the positional arguments are setting the uid argument.

ERROR: tests.core.test_host.HelpersTest.test_doesnt_add_user_if_it_already_exists
----------------------------------------------------------------------
_StringException: Traceback (most recent call last):
  File "/tmp/add_uid_gid/.venv/local/lib/python2.7/site-packages/mock.py", line 1201, in patched
    return func(*args, **keywargs)
  File "/tmp/add_uid_gid/tests/core/test_host.py", line 560, in test_doesnt_add_user_if_it_already_exists
    result = host.adduser(username, password)
  File "/tmp/add_uid_gid/charmhelpers/core/host.py", line 198, in adduser
    user_info = pwd.getpwuid(uid)
TypeError: an integer is required

FAIL: tests.core.test_host.HelpersTest.test_adds_a_user_if_it_doesnt_exist
AssertionError: Expected call: check_call(['useradd', '--create-home', '--shell', '/bin/bash', '--password', 'eodnho
j', '-g', 'johndoe', 'johndoe'])
Actual call: check_call(['useradd', '--uid eodnhoj', '--system', '-g', 'johndoe', 'johndoe'])

FAIL: tests.core.test_host.HelpersTest.test_adds_a_user_with_different_shell
AssertionError: Expected call: check_call(['useradd', '--create-home', '--shell', '/bin/zsh', '--password', 'eodnhoj
', 'johndoe'])
Actual call: check_call(['useradd', '--uid eodnhoj', '--system', 'johndoe'])

FAIL: tests.core.test_host.HelpersTest.test_adduser_with_groups
AssertionError: Expected call: check_call(['useradd', '--create-home', '--shell', '/bin/bash', '--password', 'eodnho
j', '-g', 'foo', '-G', 'bar,qux', 'johndoe'])
Actual call: check_call(['useradd', '--uid eodnhoj', '--system', '-g', 'foo', '-G', 'bar,qux', 'johndoe'])

The tests need to pass before this change can be accepted.

review: Needs Fixing

« Back to merge proposal