def test_chgroups_same_desired(self):
     '''
     Tests if the user's list of groups is the same as the arguments
     '''
     mock_primary = MagicMock(return_value='wheel')
     with patch.dict(mac_user.__salt__, {'file.gid_to_group': mock_primary}):
         self.assertTrue(mac_user.chgroups('test', 'wheel,root'))
Beispiel #2
0
 def test_chgroups_same_desired(self):
     '''
     Tests if the user's list of groups is the same as the arguments
     '''
     mock_primary = MagicMock(return_value='wheel')
     with patch.dict(mac_user.__salt__, {'file.gid_to_group': mock_primary}):
         self.assertTrue(mac_user.chgroups('test', 'wheel,root'))
Beispiel #3
0
 def test_chgroups_same_desired(self):
     '''
     Tests if the user's list of groups is the same as the arguments
     '''
     mock_primary = MagicMock(return_value='wheel')
     with patch.dict(mac_user.__salt__, {'file.gid_to_group': mock_primary}), \
             patch('salt.modules.mac_user.info', MagicMock(return_value=self.mock_info_ret)), \
             patch('salt.modules.mac_user.list_groups',
                   MagicMock(return_value=('wheel', 'root'))):
         self.assertTrue(mac_user.chgroups('test', 'wheel,root'))
Beispiel #4
0
def test_chgroups_same_desired(mock_info_ret):
    """
    Tests if the user's list of groups is the same as the arguments
    """
    mock_primary = MagicMock(return_value="wheel")
    with patch.dict(mac_user.__salt__,
                    {"file.gid_to_group": mock_primary}), patch(
                        "salt.modules.mac_user.info",
                        MagicMock(return_value=mock_info_ret)), patch(
                            "salt.modules.mac_user.list_groups",
                            MagicMock(return_value=("wheel", "root"))):
        assert mac_user.chgroups("test", "wheel,root")