def test_get_append_slash_redirect(self): """ The dispatcher should implement APPEND_SLASH handling, because ``fluent_pages.urls`` is a catch-all for ALL url's, including those without a slash. """ with override_settings(APPEND_SLASH=True): self.assertRedirects(self.client.get('/sibling1'), '/sibling1/', status_code=302) with override_settings(APPEND_SLASH=False): self.assert404('/sibling1', 'APPEND_SLASH=False: ') # However, non existing pages should not get an APPEND_SLASH redirect self.assert404('/not-found')
def test_get_append_slash_redirect(self): """ The dispatcher should implement APPEND_SLASH handling, because it has a catch-all for ALL url's, including those without a slash. """ with override_settings(APPEND_SLASH=True): self.assertRedirects(self.client.get("/sibling1"), "/sibling1/", status_code=302) with override_settings(APPEND_SLASH=False): self.assert404("/sibling1", "APPEND_SLASH=False: ") # However, non existing pages should not get an APPEND_SLASH redirect self.assert404("/not-found")
def test_app_page_append_slash(self): """ The APPEND_SLASH setting should also work for app page URLs """ with override_settings(APPEND_SLASH=True): self.assertRedirects(self.client.get('/shop'), '/shop/', status_code=302) self.assertRedirects(self.client.get('/shop/article1'), '/shop/article1/', status_code=302) with override_settings(APPEND_SLASH=False): self.assert404('/shop', 'APPEND_SLASH=False') self.assert404('/shop/article1', 'APPEND_SLASH=False') # However, non resolvable app pages should not get an APPEND_SLASH redirect self.assert404('/shop/article1/foo')