Exemple #1
0
 def test_chgid_gid_same(self):
     '''
     Tests if the group id is the same as argument
     '''
     mock = MagicMock(return_value={'gid': 10})
     with patch.object(groupadd, 'info', mock):
         self.assertTrue(groupadd.chgid('test', 10))
Exemple #2
0
 def test_chgid_gid_same(self):
     """
     Tests if the group id is the same as argument
     """
     mock_pre_gid = MagicMock(return_value=10)
     with patch.dict(groupadd.__salt__, {"file.group_to_gid": mock_pre_gid}):
         self.assertTrue(groupadd.chgid("test", 10))
Exemple #3
0
 def test_chgid_gid_same(self):
     """
     Tests if the group id is the same as argument
     """
     mock = MagicMock(return_value={"gid": 10})
     with patch.object(groupadd, "info", mock):
         self.assertTrue(groupadd.chgid("test", 10))
Exemple #4
0
 def test_chgid_gid_same(self):
     '''
     Tests if the group id is the same as argument
     '''
     mock_pre_gid = MagicMock(return_value=10)
     with patch.dict(groupadd.__salt__,
                     {'file.group_to_gid': mock_pre_gid}):
         self.assertTrue(groupadd.chgid('test', 10))
Exemple #5
0
 def test_chgid_gid_same(self):
     '''
     Tests if the group id is the same as argument
     '''
     mock_pre_gid = MagicMock(return_value=10)
     with patch.dict(groupadd.__salt__,
                     {'file.group_to_gid': mock_pre_gid}):
         self.assertTrue(groupadd.chgid('test', 10))
Exemple #6
0
 def test_chgid(self):
     '''
     Tests the gid for a named group was changed
     '''
     mock = MagicMock(return_value=None)
     with patch.dict(groupadd.__salt__, {'cmd.run': mock}):
         mock = MagicMock(side_effect=[{'gid': 10}, {'gid': 500}])
         with patch.object(groupadd, 'info', mock):
             self.assertTrue(groupadd.chgid('test', 500))
Exemple #7
0
 def test_chgid(self):
     """
     Tests the gid for a named group was changed
     """
     mock_pre_gid = MagicMock(return_value=0)
     mock_cmdrun = MagicMock(return_value=0)
     with patch.dict(groupadd.__salt__, {"file.group_to_gid": mock_pre_gid}):
         with patch.dict(groupadd.__salt__, {"cmd.run": mock_cmdrun}):
             self.assertFalse(groupadd.chgid("test", 500))
Exemple #8
0
 def test_chgid(self):
     """
     Tests the gid for a named group was changed
     """
     mock = MagicMock(return_value=None)
     with patch.dict(groupadd.__salt__, {"cmd.run": mock}):
         mock = MagicMock(side_effect=[{"gid": 10}, {"gid": 500}])
         with patch.object(groupadd, "info", mock):
             self.assertTrue(groupadd.chgid("test", 500))
Exemple #9
0
 def test_chgid(self):
     '''
     Tests the gid for a named group was changed
     '''
     mock_pre_gid = MagicMock(return_value=0)
     mock_cmdrun = MagicMock(return_value=0)
     with patch.dict(groupadd.__salt__,
                     {'file.group_to_gid': mock_pre_gid}):
         with patch.dict(groupadd.__salt__, {'cmd.run': mock_cmdrun}):
             self.assertFalse(groupadd.chgid('test', 500))
Exemple #10
0
 def test_chgid(self):
     '''
     Tests the gid for a named group was changed
     '''
     mock_pre_gid = MagicMock(return_value=0)
     mock_cmdrun = MagicMock(return_value=0)
     with patch.dict(groupadd.__salt__,
                     {'file.group_to_gid': mock_pre_gid}):
         with patch.dict(groupadd.__salt__, {'cmd.run': mock_cmdrun}):
             self.assertFalse(groupadd.chgid('test', 500))