Skip to content

Commit

Permalink
add more tests for cache_utils.py
Browse files Browse the repository at this point in the history
  • Loading branch information
FilomenoSanchez committed Apr 16, 2021
1 parent db6385b commit b96b515
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions utils/tests/test_cache_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,16 @@ def test_8(self):
expected = {b'id': cache_utils.compress_data(self.session_id)}
self.assertDictEqual(expected, self.cache.hgetall(self.session_id))

def test_(self):

cache_utils.store_density(self.session_id, density_cachekey, density, self.cache)
cache_utils.store_density()
cache_utils.retrieve_density()
cache_utils.remove_density()
cache_utils.remove_all_density()
def test_9(self):
cachekey_1 = 'fname_1_{}_2'.format(cache_utils.CacheKeys.METADATA_TAG.value).encode()
density_1 = [1, 2, 3, 3, 4, 5]
cachekey_2 = 'fname_2_{}_2'.format(cache_utils.CacheKeys.METADATA_TAG.value).encode()
density_2 = [5, 6, 7, 8, 9, 0]

cache_utils.store_density(self.session_id, cachekey_1, density_1, self.cache)
cache_utils.store_density(self.session_id, cachekey_2, density_2, self.cache)
output = cache_utils.retrieve_density(self.session_id, cachekey_2, self.cache)
self.assertListEqual(output, density_2)
expected_cache = {b'id': cache_utils.compress_data(self.session_id)}
cache_utils.remove_all_density(self.session_id, self.cache)
self.assertDictEqual(expected_cache, self.cache.hgetall(self.session_id))

0 comments on commit b96b515

Please sign in to comment.