Exemplo n.º 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)
Exemplo n.º 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())
Exemplo n.º 3
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())
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 7
0
 def test_getent(self):
     '''
     Test if user.getent already have a value
     '''
     self.assertTrue(useradd.getent())
Exemplo n.º 8
0
 def test_getent(self):
     '''
     Test if user.getent already have a value
     '''
     self.assertTrue(useradd.getent())