This adds a test to make sure kwargs are passed to client
This commit is contained in:
@@ -6,6 +6,7 @@ from pymemcache import pool
|
|||||||
from .test_client import ClientTestMixin, MockSocket
|
from .test_client import ClientTestMixin, MockSocket
|
||||||
import unittest
|
import unittest
|
||||||
import pytest
|
import pytest
|
||||||
|
import mock
|
||||||
|
|
||||||
|
|
||||||
class TestHashClient(ClientTestMixin, unittest.TestCase):
|
class TestHashClient(ClientTestMixin, unittest.TestCase):
|
||||||
@@ -34,6 +35,16 @@ class TestHashClient(ClientTestMixin, unittest.TestCase):
|
|||||||
|
|
||||||
return client
|
return client
|
||||||
|
|
||||||
|
def test_setup_client_without_pooling(self):
|
||||||
|
with mock.patch('pymemcache.client.hash.Client') as internal_client:
|
||||||
|
client = HashClient([], timeout=999, key_prefix='foo_bar_baz')
|
||||||
|
client.add_server('127.0.0.1', '11211')
|
||||||
|
|
||||||
|
assert internal_client.call_args[0][0] == ('127.0.0.1', '11211')
|
||||||
|
kwargs = internal_client.call_args[1]
|
||||||
|
assert kwargs['timeout'] == 999
|
||||||
|
assert kwargs['key_prefix'] == 'foo_bar_baz'
|
||||||
|
|
||||||
def test_get_many_all_found(self):
|
def test_get_many_all_found(self):
|
||||||
client = self.make_client(*[
|
client = self.make_client(*[
|
||||||
[b'STORED\r\n', b'VALUE key3 0 6\r\nvalue2\r\nEND\r\n', ],
|
[b'STORED\r\n', b'VALUE key3 0 6\r\nvalue2\r\nEND\r\n', ],
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
|
mock
|
||||||
pytest
|
pytest
|
||||||
pytest-cov
|
pytest-cov
|
||||||
|
|||||||
Reference in New Issue
Block a user