twisted.test.test_memcache.CommandMixin
class documentationtwisted.test.test_memcache
(View In Hierarchy)
Known subclasses: twisted.test.test_memcache.CommandFailureTests, twisted.test.test_memcache.MemCacheTests
Setup and tests for basic invocation of MemCacheProtocol
commands.
Method | test_get | MemCacheProtocol.get
returns a Deferred which
is called back with the value and the flag associated with the given key if
the server returns a successful result. |
Method | test_emptyGet | Test getting a non-available key: it succeeds but return None
as value and 0 as flag. |
Method | test_getMultiple | MemCacheProtocol.getMultiple
returns a Deferred which
is called back with a dictionary of flag, value for each given key. |
Method | test_getMultipleWithEmpty | When MemCacheProtocol.getMultiple
is called with non-available keys, the corresponding tuples are (0,
None). |
Method | test_set | MemCacheProtocol.set
returns a Deferred which
is called back with True when the operation succeeds. |
Method | test_add | MemCacheProtocol.add
returns a Deferred which
is called back with True when the operation succeeds. |
Method | test_replace | MemCacheProtocol.replace
returns a Deferred which
is called back with True when the operation succeeds. |
Method | test_errorAdd | Test an erroneous add: if a MemCacheProtocol.add
is called but the key already exists on the server, it returns a NOT
STORED answer, which calls back the resulting Deferred with
False . |
Method | test_errorReplace | Test an erroneous replace: if a MemCacheProtocol.replace
is called but the key doesn't exist on the server, it returns a NOT
STORED answer, which calls back the resulting Deferred with
False . |
Method | test_delete | MemCacheProtocol.delete
returns a Deferred which
is called back with True when the server notifies a
success. |
Method | test_errorDelete | Test an error during a delete: if key doesn't exist on the server, it
returns a NOT FOUND answer which calls back the resulting Deferred with
False . |
Method | test_increment | Test incrementing a variable: MemCacheProtocol.increment
returns a Deferred which
is called back with the incremented value of the given key. |
Method | test_decrement | Test decrementing a variable: MemCacheProtocol.decrement
returns a Deferred which
is called back with the decremented value of the given key. |
Method | test_incrementVal | MemCacheProtocol.increment
takes an optional argument value which replaces the default
value of 1 when specified. |
Method | test_decrementVal | MemCacheProtocol.decrement
takes an optional argument value which replaces the default
value of 1 when specified. |
Method | test_stats | Test retrieving server statistics via the MemCacheProtocol.stats
command: it parses the data sent by the server and calls back the resulting
Deferred
with a dictionary of the received statistics. |
Method | test_statsWithArgument | No summary |
Method | test_version | Test version retrieval via the MemCacheProtocol.version
command: it returns a Deferred which
is called back with the version sent by the server. |
Method | test_flushAll | MemCacheProtocol.flushAll
returns a Deferred which
is called back with True if the server acknowledges
success. |
Method | _test | Helper test method to test the resulting Deferred of a MemCacheProtocol
command. |
Helper test method to test the resulting Deferred
of a MemCacheProtocol
command.
MemCacheProtocol.get
returns a Deferred
which
is called back with the value and the flag associated with the given key if
the server returns a successful result.
Test getting a non-available key: it succeeds but return None
as value and 0
as flag.
MemCacheProtocol.getMultiple
returns a Deferred
which
is called back with a dictionary of flag, value for each given key.
When MemCacheProtocol.getMultiple
is called with non-available keys, the corresponding tuples are (0,
None).
MemCacheProtocol.set
returns a Deferred
which
is called back with True
when the operation succeeds.
MemCacheProtocol.add
returns a Deferred
which
is called back with True
when the operation succeeds.
MemCacheProtocol.replace
returns a Deferred
which
is called back with True
when the operation succeeds.
Test an erroneous add: if a MemCacheProtocol.add
is called but the key already exists on the server, it returns a NOT
STORED answer, which calls back the resulting Deferred
with
False
.
Test an erroneous replace: if a MemCacheProtocol.replace
is called but the key doesn't exist on the server, it returns a NOT
STORED answer, which calls back the resulting Deferred
with
False
.
MemCacheProtocol.delete
returns a Deferred
which
is called back with True
when the server notifies a
success.
Test an error during a delete: if key doesn't exist on the server, it
returns a NOT FOUND answer which calls back the resulting Deferred
with
False
.
Test incrementing a variable: MemCacheProtocol.increment
returns a Deferred
which
is called back with the incremented value of the given key.
Test decrementing a variable: MemCacheProtocol.decrement
returns a Deferred
which
is called back with the decremented value of the given key.
MemCacheProtocol.increment
takes an optional argument value
which replaces the default
value of 1 when specified.
MemCacheProtocol.decrement
takes an optional argument value
which replaces the default
value of 1 when specified.
Test retrieving server statistics via the MemCacheProtocol.stats
command: it parses the data sent by the server and calls back the resulting
Deferred
with a dictionary of the received statistics.
MemCacheProtocol.stats
takes an optional bytes
argument which, if specified, is sent
along with the STAT command. The STAT responses from the
server are parsed as key/value pairs and returned as a dict
(as in the case where the argument is not specified).
Test version retrieval via the MemCacheProtocol.version
command: it returns a Deferred
which
is called back with the version sent by the server.
MemCacheProtocol.flushAll
returns a Deferred
which
is called back with True
if the server acknowledges
success.