Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
    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)
Ejemplo n.º 3
0
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