def test_invalidate_cache_user_profile_country_updated(self): country = 'US' self.profile.country = country self.profile.save() cache_key = UserProfile.country_cache_key_name(self.user.id) assert cache.get(cache_key) is None cache.set(cache_key, self.profile.country) assert cache.get(cache_key) == country country = 'bd' self.profile.country = country self.profile.save() assert cache.get(cache_key) != country assert cache.get(cache_key) is None
def test_invalidate_cache_user_profile_country_updated(self): country = 'US' self.profile.country = country self.profile.save() cache_key = UserProfile.country_cache_key_name(self.user.id) self.assertIsNone(cache.get(cache_key)) cache.set(cache_key, self.profile.country) self.assertEqual(cache.get(cache_key), country) country = 'bd' self.profile.country = country self.profile.save() self.assertNotEqual(cache.get(cache_key), country) self.assertIsNone(cache.get(cache_key))