Example #1
0
 def test_site_not_set_if_missing(self):
     middleware = SetSiteMiddleware()
     r = HttpRequest()
     self.assertIsNone(middleware.process_request(r))
     self.assertIsNone(r.site)
 def test_site_not_set_if_missing(self):
     middleware = SetSiteMiddleware()
     r = HttpRequest()
     self.assertIsNone(middleware.process_request(r))
     self.assertIsNone(r.site)
Example #3
0
 def test_site_set_if_exists(self):
     site = SitesCollection().create_item(SINGLE_SITE_ID)
     middleware = SetSiteMiddleware()
     r = HttpRequest()
     self.assertIsNone(middleware.process_request(r))
     self.assertEqual(SINGLE_SITE_ID, r.site.site_id)
 def test_site_set_if_exists(self):
     site = SitesCollection().create_item(SINGLE_SITE_ID)
     middleware = SetSiteMiddleware()
     r = HttpRequest()
     self.assertIsNone(middleware.process_request(r))
     self.assertEqual(SINGLE_SITE_ID, r.site.site_id)