TestMemoryCache

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

MemoryCache Test cases for caching related functions/classes in privex.helpers.cache

__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()

Set the current cache adapter to an instance of MemoryCache() and make it available through self.cache

tearDownClass()

Hook method for deconstructing the class fixture after running all tests in the class.

test_cache_expire()

Test that cache keys are removed after the specified timeout

test_cache_remove()

Test that cache.remove correctly removes cache keys

test_cache_set()

Test basic cache.set and cache.get

test_cache_update_timeout()

Test that cache.update_timeout extends timeouts correctly

test_cache_update_timeout_raise()

Test that cache.update_timeout raises CacheNotFound if the key does not exist

Attributes

Attributes

cache_keys

A list of all cache keys used during the test case, so they can be removed by tearDown() once done.