def test_save_deletes_cached_response_data(self): cache_key = generate_cache_key(self.backend, self.valid_data["url"]) submit, r = self._prepare_step2_data(self.url, self.valid_data) self.assertIn(cache_key, cache) self.client.post(self.url, submit) self.assertIsNone(cache.get(cache_key))
def test_step1_caches_response_data_and_overwrites_possible_existing(self): cache_key = generate_cache_key(self.backend, self.valid_data["url"]) dummy_data = ("The key could already exist from a previous attempt. We " "don't care as long as a successful response overrides.") cache.set(cache_key, dummy_data, 10) r = self.client.post(self.url, self.valid_data) self.assertEqual( r.context["form"].instance.response_cache, cache.get(cache_key))