diff options
author | Matej Spiller Muys <matej.spiller-muys@bitstamp.net> | 2023-01-20 09:36:57 +0100 |
---|---|---|
committer | Matej Spiller Muys <matej.spiller-muys@bitstamp.net> | 2023-01-31 06:32:53 +0100 |
commit | 7d871868199133818d821cf17d20fdb5727b6ace (patch) | |
tree | 7b4a8ae3a32f6c30444a3b9cb17a766421aea626 /pymemcache/test/test_integration.py | |
parent | 7c3678730dc34afab57b836a9b6f164593aef5c7 (diff) | |
download | pymemcache-7d871868199133818d821cf17d20fdb5727b6ace.tar.gz |
Support for Gat and Gats, Support passing server key in a tuple
Diffstat (limited to 'pymemcache/test/test_integration.py')
-rw-r--r-- | pymemcache/test/test_integration.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/pymemcache/test/test_integration.py b/pymemcache/test/test_integration.py index 19d04f2..64a8b0a 100644 --- a/pymemcache/test/test_integration.py +++ b/pymemcache/test/test_integration.py @@ -272,6 +272,37 @@ def test_touch(client_class, host, port, socket_module, key_prefix): @pytest.mark.integration() +def test_gat_gats(client_class, host, port, socket_module, key_prefix): + client = client_class( + (host, port), socket_module=socket_module, key_prefix=key_prefix + ) + client.flush_all() + + direct_client = ( + client if hasattr(client, "raw_command") else list(client.clients.values())[0] + ) + + result = client.set(b"key", b"0", 10, noreply=False) + assert result is True + + ttl1 = direct_client.raw_command(b"mg " + key_prefix + b"key t").replace( + b"HD t", b"" + ) + + result = client.gat(b"key", expire=1000) + assert result == b"0" + + result, cas = client.gats(b"key", expire=1000) + assert result == b"0" + + ttl2 = direct_client.raw_command(b"mg " + key_prefix + b"key t").replace( + b"HD t", b"" + ) + + assert int(ttl1) < 950 < int(ttl2) <= 1000 + + +@pytest.mark.integration() def test_misc(client_class, host, port, socket_module, key_prefix): client = Client((host, port), socket_module=socket_module, key_prefix=key_prefix) client.flush_all() |