Пример #1
0
 def testCacheDiffersByUrl(self):
     """ Проверяет, что кэш отличается для разных URL."""
     p2 = Project.objects.create(name="another")
     Module.objects.create(project=p2, name="m3")
     self.url = reverse('test', args=(p2.pk,))
     response = self.client.get(self.url)
     cache_key = TestView.get_cache_key(response._request)
     cache_content = self.redis.get(cache_key)
     self.assertNotEqual(cache_content, self.cache_content)
Пример #2
0
 def setUp(self):
     self.project = Project.objects.create(name="project")
     self.m1 = Module.objects.create(project=self.project, name="m1")
     self.m2 = Module.objects.create(project=self.project, name="m2")
     self.url = self.get_url()
     self.response = self.client.get(self.url)
     self.redis = cacheops.conf.redis_client
     self.cache_key = TestView.get_cache_key(self.response._request)
     self.cache_content = self.redis.get(self.cache_key)