Example #1
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))
Example #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))
Example #3
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))
Example #4
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))