def test_getent_user(self): """ Tests the return information on all users """ with patch("pwd.getpwall", MagicMock(return_value=[""])): ret = [ { "gid": 0, "groups": ["root"], "home": "/root", "name": "root", "passwd": "x", "shell": "/bin/bash", "uid": 0, "fullname": "root", "roomnumber": "", "workphone": "", "homephone": "", "other": "", } ] with patch( "salt.modules.useradd._format_info", MagicMock(return_value=self.mock_pwall), ): self.assertEqual(useradd.getent(), ret)
def test_getent(self): ''' Test if user.getent already have a value ''' with patch('salt.modules.useradd.__context__', MagicMock(return_value='Salt')): self.assertTrue(useradd.getent())
def test_getent(self): """ Test if user.getent already have a value """ with patch("salt.modules.useradd.__context__", MagicMock(return_value="Salt")): self.assertTrue(useradd.getent())
def test_getent_user(self): ''' Tests the return information on all users ''' ret = [{'gid': 0, 'groups': ['root'], 'home': '/root', 'name': 'root', 'passwd': 'x', 'shell': '/bin/bash', 'uid': 0, 'fullname': 'root', 'roomnumber': '', 'workphone': '', 'homephone': ''}] self.assertEqual(useradd.getent(), ret)
def test_getent_user(self): ''' Tests the return information on all users ''' with patch('pwd.getpwall', MagicMock(return_value=[''])): ret = [{'gid': 0, 'groups': ['root'], 'home': '/root', 'name': 'root', 'passwd': 'x', 'shell': '/bin/bash', 'uid': 0, 'fullname': 'root', 'roomnumber': '', 'workphone': '', 'homephone': '', 'other': ''}] with patch('salt.modules.useradd._format_info', MagicMock(return_value=self.mock_pwall)): self.assertEqual(useradd.getent(), ret)
def test_getent(self): ''' Test if user.getent already have a value ''' self.assertTrue(useradd.getent())