コード例 #1
0
ファイル: redismod_test.py プロジェクト: DaveQB/salt
    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)
コード例 #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)
コード例 #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