This adds a test to make sure kwargs are passed to client

This commit is contained in:
John Anderson
2015-07-20 22:02:11 -07:00
parent acc0b0f414
commit 9057483867
2 changed files with 12 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ from pymemcache import pool
from .test_client import ClientTestMixin, MockSocket
import unittest
import pytest
import mock
class TestHashClient(ClientTestMixin, unittest.TestCase):
@@ -34,6 +35,16 @@ class TestHashClient(ClientTestMixin, unittest.TestCase):
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):
client = self.make_client(*[
[b'STORED\r\n', b'VALUE key3 0 6\r\nvalue2\r\nEND\r\n', ],

View File

@@ -1,2 +1,3 @@
mock
pytest
pytest-cov