def test_set_(): """ Test to verify that the given module is set to the given target """ name = "myeselect" target = "hardened/linux/amd64" ret = {"name": name, "result": True, "comment": "", "changes": {}} mock = MagicMock(return_value=target) with patch.dict(eselect.__salt__, {"eselect.get_current_target": mock}): comt = "Target '{}' is already set on '{}' module.".format(target, name) ret.update({"comment": comt}) assert eselect.set_(name, target) == ret
def test_set_(self): ''' Test to verify that the given module is set to the given target ''' name = 'myeselect' target = 'hardened/linux/amd64' ret = {'name': name, 'result': True, 'comment': '', 'changes': {}} mock = MagicMock(return_value=target) with patch.dict(eselect.__salt__, {'eselect.get_current_target': mock}): comt = ('Target \'{0}\' is already set on \'{1}\' module.'.format( target, name)) ret.update({'comment': comt}) self.assertDictEqual(eselect.set_(name, target), ret)
def test_set_(self): ''' Test to verify that the given module is set to the given target ''' name = 'myeselect' target = 'hardened/linux/amd64' ret = {'name': name, 'result': True, 'comment': '', 'changes': {}} mock = MagicMock(return_value=target) with patch.dict(eselect.__salt__, {'eselect.get_current_target': mock}): comt = ('Target \'{0}\' is already set on \'{1}\' module.' .format(target, name)) ret.update({'comment': comt}) self.assertDictEqual(eselect.set_(name, target), ret)