def test_fail_with_changes(self): """ Test to returns failure and changes is not empty. """ ret = {"name": "salt", "changes": {}, "result": False, "comment": ""} with patch.dict(test.__opts__, {"test": False}): ret.update({ "changes": { "testing": { "new": "Something pretended" " to change", "old": "Unchanged", } }, "comment": "Success!", "result": True, }) self.assertDictEqual(test.succeed_with_changes("salt"), ret) with patch.dict(test.__opts__, {"test": False}): ret.update({ "changes": { "testing": { "new": "Something pretended" " to change", "old": "Unchanged", } }, "comment": "A failure comment!", "result": True, }) self.assertDictEqual( test.succeed_with_changes("salt", comment="A failure comment!"), ret)
def test_succeed_with_changes(self): """ Test to returns successful and changes is not empty """ ret = {"name": "salt", "changes": {}, "result": False, "comment": ""} with patch.dict(test.__opts__, {"test": False}): ret.update({ "changes": { "testing": { "new": "Something pretended to change", "old": "Unchanged", } }, "comment": "Success!", "result": True, }) self.assertDictEqual(test.succeed_with_changes("salt"), ret) with patch.dict(test.__opts__, {"test": False}): ret.update({ "changes": { "testing": { "new": "Something pretended to change", "old": "Unchanged", } }, "comment": "A success comment!", "result": True, }) self.assertDictEqual( test.succeed_with_changes("salt", comment="A success comment!"), ret) with patch.dict(test.__opts__, {"test": True}): ret.update({ "changes": { "testing": { "new": "Something pretended to change", "old": "Unchanged", } }, "comment": "If we weren't testing, this would be successful with changes", "result": None, }) self.assertDictEqual( test.succeed_with_changes("salt", comment="A success comment!"), ret)
def test_succeed_with_changes(self): ''' Test to returns successful and changes is not empty ''' ret = {'name': 'salt', 'changes': {}, 'result': False, 'comment': ''} with patch.dict(test.__opts__, {"test": False}): ret.update({'changes': {'testing': {'new': 'Something pretended' ' to change', 'old': 'Unchanged'}}, 'comment': 'Success!', 'result': True}) self.assertDictEqual(test.succeed_with_changes('salt'), ret)
def test_succeed_with_changes(self): ''' Test to returns successful and changes is not empty ''' ret = {'name': 'salt', 'changes': {}, 'result': False, 'comment': ''} with patch.dict(test.__opts__, {"test": False}): ret.update({'changes': {'testing': {'new': 'Something pretended' ' to change', 'old': 'Unchanged'}}, 'comment': 'Success!', 'result': True}) self.assertDictEqual(test.succeed_with_changes('salt'), ret)
def test_configurable_test_state(self): ''' Test of a configurable test state which determines its output based on the inputs. ''' ret = {'name': 'salt', 'changes': {}, 'result': True, 'comment': ''} with patch.dict(test.__opts__, {"test": False}): ret.update({'changes': {'testing': {'new': 'Something pretended' ' to change', 'old': 'Unchanged'}}, 'comment': 'Success!'}) self.assertDictEqual(test.succeed_with_changes('salt'), ret)
def test_configurable_test_state(self): ''' Test of a configurable test state which determines its output based on the inputs. ''' ret = {'name': 'salt', 'changes': {}, 'result': True, 'comment': ''} with patch.dict(test.__opts__, {"test": False}): ret.update({ 'changes': { 'testing': { 'new': 'Something pretended' ' to change', 'old': 'Unchanged' } }, 'comment': 'Success!' }) self.assertDictEqual(test.succeed_with_changes('salt'), ret)