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=0)
     with patch.dict(mac_group.__salt__,
                     {'file.group_to_gid': mock_pre_gid}):
         self.assertTrue(mac_group.chgid('test', 0))
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=0)
     with patch.dict(mac_group.__salt__,
                     {'file.group_to_gid': mock_pre_gid}):
         self.assertTrue(mac_group.chgid('test', 0))
Example #3
0
 def test_chgid(self):
     '''
     Tests the gid for a named group was changed
     '''
     mock_pre_gid = MagicMock(return_value=0)
     mock_ret = MagicMock(return_value=0)
     with patch.dict(mac_group.__salt__,
                     {'file.group_to_gid': mock_pre_gid}):
         with patch.dict(mac_group.__salt__, {'cmd.retcode': mock_ret}):
             self.assertTrue(mac_group.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_ret = MagicMock(return_value=0)
     with patch.dict(mac_group.__salt__,
                     {'file.group_to_gid': mock_pre_gid}):
         with patch.dict(mac_group.__salt__, {'cmd.retcode': mock_ret}):
             self.assertTrue(mac_group.chgid('test', 500))
Example #5
0
def test_chgid_gid_same():
    """
    Tests if the group id is the same as argument
    """
    mock_group = {"passwd": "*", "gid": 0, "name": "test", "members": ["root"]}
    mock_pre_gid = MagicMock(return_value=0)
    with patch.dict(mac_group.__salt__, {"file.group_to_gid": mock_pre_gid}), patch(
        "salt.modules.mac_group.info", MagicMock(return_value=mock_group)
    ):
        assert mac_group.chgid("test", 0)
Example #6
0
def test_chgid():
    """
    Tests the gid for a named group was changed
    """
    mock_group = {"passwd": "*", "gid": 0, "name": "test", "members": ["root"]}
    mock_pre_gid = MagicMock(return_value=0)
    mock_ret = MagicMock(return_value=0)
    with patch.dict(mac_group.__salt__,
                    {"file.group_to_gid": mock_pre_gid}), patch.dict(
                        mac_group.__salt__, {"cmd.retcode": mock_ret}), patch(
                            "salt.modules.mac_group.info",
                            MagicMock(return_value=mock_group)):
        assert mac_group.chgid("test", 500)
Example #7
0
 def test_chgid_gid_same(self):
     '''
     Tests if the group id is the same as argument
     '''
     mock_group = {
         'passwd': '*',
         'gid': 0,
         'name': 'test',
         'members': ['root']
     }
     mock_pre_gid = MagicMock(return_value=0)
     with patch.dict(mac_group.__salt__,
                     {'file.group_to_gid': mock_pre_gid}), \
             patch('salt.modules.mac_group.info', MagicMock(return_value=mock_group)):
         self.assertTrue(mac_group.chgid('test', 0))
Example #8
0
 def test_chgid(self):
     '''
     Tests the gid for a named group was changed
     '''
     mock_group = {
         'passwd': '*',
         'gid': 0,
         'name': 'test',
         'members': ['root']
     }
     mock_pre_gid = MagicMock(return_value=0)
     mock_ret = MagicMock(return_value=0)
     with patch.dict(mac_group.__salt__,
                     {'file.group_to_gid': mock_pre_gid}), \
             patch.dict(mac_group.__salt__, {'cmd.retcode': mock_ret}), \
             patch('salt.modules.mac_group.info', MagicMock(return_value=mock_group)):
         self.assertTrue(mac_group.chgid('test', 500))