def test_delete_pattern_calls_make_key(self, init_mock, make_key_mock): client = DefaultClient() client._backend = Mock() redis_client = fakeredis.FakeStrictRedis() client.delete_pattern(pattern='foo*', client=redis_client) make_key_mock.assert_called_once_with('foo*', version=None, prefix=None)
def test_delete_pattern_calls_get_client_given_no_client(self, init_mock, get_client_mock): client = DefaultClient() client._backend = Mock() client._backend.key_prefix = '' client.delete_pattern(pattern='foo*') get_client_mock.assert_called_once_with(write=True)
def test_delete_pattern_calls_get_client_given_no_client(self, init_mock, get_client_mock): client = DefaultClient() client._backend = Mock() client._backend.key_prefix = '' client.delete_pattern(pattern='foo*') get_client_mock.assert_called_once_with(write=True)
def test_delete_pattern_calls_scan_iter_with_count_if_itersize_given( self, init_mock, get_client_mock, make_key_mock): client = DefaultClient() client._backend = Mock() get_client_mock.return_value.scan_iter.return_value = [] client.delete_pattern(pattern='foo*', itersize=90210) get_client_mock.return_value.scan_iter.assert_called_once_with( count=90210, match=make_key_mock.return_value)
def test_delete_pattern_calls_get_client_given_no_client( self, init_mock, get_client_mock ): get_client_mock.return_value.scan_iter.return_value = iter([]) client = DefaultClient() client._backend = Mock() client._backend.key_prefix = "" client.delete_pattern(pattern="foo*") get_client_mock.assert_called_once_with(write=True)
def test_delete_pattern_calls_scan_iter_with_count_if_itersize_given( self, init_mock, get_client_mock, make_pattern_mock): client = DefaultClient() client._backend = Mock() client._backend.key_prefix = '' get_client_mock.return_value.scan_iter.return_value = [] client.delete_pattern(pattern='foo*', itersize=90210) get_client_mock.return_value.scan_iter.assert_called_once_with( count=90210, match=make_pattern_mock.return_value)
def test_delete_pattern_calls_make_pattern( self, init_mock, get_client_mock, make_pattern_mock ): client = DefaultClient() client._backend = Mock() client._backend.key_prefix = "" get_client_mock.return_value.scan_iter.return_value = [] client.delete_pattern(pattern="foo*") kwargs = {"version": None, "prefix": None} make_pattern_mock.assert_called_once_with("foo*", **kwargs)
def test_delete_pattern_calls_make_pattern( self, init_mock, get_client_mock, make_pattern_mock): client = DefaultClient() client._backend = Mock() client._backend.key_prefix = '' get_client_mock.return_value.scan_iter.return_value = [] client.delete_pattern(pattern='foo*') kwargs = {'version': None, 'prefix': None} # if not isinstance(caches['default'].client, ShardClient): # kwargs['prefix'] = None make_pattern_mock.assert_called_once_with('foo*', **kwargs)
def test_delete_pattern_calls_make_pattern( self, init_mock, get_client_mock, make_pattern_mock): client = DefaultClient() client._backend = Mock() client._backend.key_prefix = '' get_client_mock.return_value.scan_iter.return_value = [] client.delete_pattern(pattern='foo*') kwargs = {'version': None, 'prefix': None} # if not isinstance(caches['default'].client, ShardClient): # kwargs['prefix'] = None make_pattern_mock.assert_called_once_with('foo*', **kwargs)
def test_delete_pattern_calls_make_pattern( self, init_mock, get_client_mock, make_pattern_mock ): client = DefaultClient() client._backend = Mock() client._backend.key_prefix = "" get_client_mock.return_value.scan_iter.return_value = iter([]) client.delete_pattern(pattern="foo*") kwargs = {"version": None, "prefix": None} # if not isinstance(caches['default'].client, ShardClient): # kwargs['prefix'] = None make_pattern_mock.assert_called_once_with("foo*", **kwargs)