Beispiel #1
0
 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)
Beispiel #2
0
 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())
Beispiel #4
0
 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)
Beispiel #5
0
 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)
Beispiel #6
0
 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)
Beispiel #7
0
 def test_getent(self):
     '''
     Test if user.getent already have a value
     '''
     self.assertTrue(useradd.getent())
Beispiel #8
0
 def test_getent(self):
     '''
     Test if user.getent already have a value
     '''
     self.assertTrue(useradd.getent())