def test_delete_missing_key(self): try: RequestCache.delete(TEST_KEY) except KeyError: self.fail( 'Deleting a missing key from the request cache should not cause an error.' )
def test_delete(self): RequestCache.set(TEST_KEY, EXPECTED_VALUE) RequestCache.set(TEST_KEY_2, EXPECTED_VALUE) RequestCache.delete(TEST_KEY) cached_response = RequestCache.get_cached_response(TEST_KEY) self.assertTrue(cached_response.is_miss) cached_response = RequestCache.get_cached_response(TEST_KEY_2) self.assertTrue(cached_response.is_hit) self.assertEqual(cached_response.value, EXPECTED_VALUE)