TestCacheDecoratorMemory

class tests.test_cache.TestCacheDecoratorMemory(methodName='runTest')[source]

Test that the decorator privex.helpers.decorators.r_cache() caches correctly, with adapter privex.helpers.cache.MemoryCache.MemoryCache and also verifies dynamic cache key generation works as expected.

__init__(methodName='runTest')

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

Methods

Methods

setUpClass()

Hook method for setting up class fixture before running tests in the class.

tearDown()

Remove any Redis keys used during test, to avoid failure on re-run

test_rcache_callable()

Decorate random string function - use a lambda callable to determine a cache key

test_rcache_rand()

Decorate random string function with r_cache - test that two calls return the same string

test_rcache_rand_dynamic()

Decorate random string function with r_cache and use format_args for dynamic cache string testing

Attributes

Attributes

cache