Add test case for numeric GECOS data

This commit is contained in:
Erik Johnson 2013-12-06 16:16:38 -06:00
parent c8e5381aae
commit e618befaf8

View File

@ -127,6 +127,25 @@ class UserTest(integration.ModuleCase,
ret = self.run_state('group.absent', name='salt_test')
self.assertSaltTrueReturn(ret)
@destructiveTest
@skipIf(os.geteuid() != 0, 'you must be root to run this test')
def test_user_present_gecos(self):
'''
This is a DESTRUCTIVE TEST it creates a new user on the on the minion.
It ensures that numeric GECOS data will be properly coerced to strings,
otherwise the state will fail because the GECOS fields are written as
strings (and show up in the user.info output as such). Thus the
comparison will fail, since '12345' != 12345.
'''
ret = self.run_state(
'user.present', name='salt_test', fullname=12345, roomnumber=123,
workphone=1234567890, homephone=1234567890
)
self.assertSaltTrueReturn(ret)
ret = self.run_state('user.absent', name='salt_test')
self.assertSaltTrueReturn(ret)
if __name__ == '__main__':
from integration import run_tests