Esempio n. 1
0
    def test_setup_casts(self):
        with patch.object(aiomcache, "Client",
                          autospec=True) as aiomcache_client:
            memcached = MemcachedBackend(pool_size="10")

            aiomcache_client.assert_called_with("127.0.0.1",
                                                11211,
                                                loop=ANY,
                                                pool_size=10)

        assert memcached.pool_size == 10
Esempio n. 2
0
    def test_setup(self):
        with patch.object(aiomcache, "Client",
                          autospec=True) as aiomcache_client:
            memcached = MemcachedBackend()

            aiomcache_client.assert_called_with("127.0.0.1",
                                                11211,
                                                loop=ANY,
                                                pool_size=2)

        assert memcached.endpoint == "127.0.0.1"
        assert memcached.port == 11211
        assert memcached.pool_size == 2
Esempio n. 3
0
    def test_setup_override(self):
        with patch.object(aiomcache, "Client",
                          autospec=True) as aiomcache_client:
            memcached = MemcachedBackend(endpoint="127.0.0.2",
                                         port=2,
                                         pool_size=10)

            aiomcache_client.assert_called_with("127.0.0.2",
                                                2,
                                                loop=ANY,
                                                pool_size=10)

        assert memcached.endpoint == "127.0.0.2"
        assert memcached.port == 2
        assert memcached.pool_size == 10
Esempio n. 4
0
def memcached():
    memcached = MemcachedBackend()
    memcached.client = MagicMock(spec=aiomcache.Client)
    yield memcached
Esempio n. 5
0
 def test_parse_uri_path(self):
     assert MemcachedBackend.parse_uri_path("/1/2/3") == {}