def test_string(self): ''' Test to ensure that the key exists in redis with the value specified. ''' name = 'key_in_redis' value = 'string data' ret = {'name': name, 'changes': {}, 'result': True, 'comment': 'Key already set to defined value'} mock = MagicMock(return_value=value) with patch.dict(redismod.__salt__, {'redis.get_key': mock}): self.assertDictEqual(redismod.string(name, value), ret)
def test_string(): """ Test to ensure that the key exists in redis with the value specified. """ name = "key_in_redis" value = "string data" ret = { "name": name, "changes": {}, "result": True, "comment": "Key already set to defined value", } mock = MagicMock(return_value=value) with patch.dict(redismod.__salt__, {"redis.get_key": mock}): assert redismod.string(name, value) == ret