def test_user_doesnt_see_warning_in_maintenance_mode(self): response = self.client.get('/') self.assertNotContains(response, self.admin_warning) maintenance.enable() response = self.client.get('/') self.assertNotContains(response, self.admin_warning, status_code=503)
def test_user_doesnt_see_warning_in_maintenance_mode(self): response = self.client.get('/') self.assertNotContains(response, self.admin_warning) maintenance.enable() response = self.client.get('/') self.assertNotContains(response, self.admin_warning, status_code=503)
def test_user_sees_503_instead_of_redirect(self): response = self.client.get('/redirect/', follow=True) self.assertRedirects(response, '/', status_code=301) maintenance.enable() response = self.client.get('/redirect/', follow=True) self.assertFalse(response.redirect_chain) self.assertTemplateUsed(response, '503.html')
def test_user_sees_503_instead_of_redirect(self): response = self.client.get('/redirect/', follow=True) self.assertRedirects(response, '/', status_code=301) maintenance.enable() response = self.client.get('/redirect/', follow=True) self.assertFalse(response.redirect_chain) self.assertTemplateUsed(response, '503.html')
def test_user_sees_503_error_page_instead_of_index_page(self): response = self.client.get('/') self.assertContains(response, test_index_page_text, status_code=200) self.assertTemplateNotUsed(response, '503.html') maintenance.enable() response = self.client.get('/') self.assertNotContains(response, test_index_page_text, status_code=503) self.assertTemplateUsed(response, '503.html')
def test_admin_doesnt_see_503_error_page_instead_of_actual_content(self): self.create_admin_and_login() response = self.client.get('/') self.assertContains(response, test_index_page_text) maintenance.enable() response = self.client.get('/') self.assertContains(response, test_index_page_text)
def test_admin_doesnt_see_503_error_page_instead_of_actual_content(self): self.create_admin_and_login() response = self.client.get('/') self.assertContains(response, test_index_page_text) maintenance.enable() response = self.client.get('/') self.assertContains(response, test_index_page_text)
def test_user_sees_503_error_page_instead_of_index_page(self): response = self.client.get('/') self.assertContains(response, test_index_page_text, status_code=200) self.assertTemplateNotUsed(response, '503.html') maintenance.enable() response = self.client.get('/') self.assertNotContains(response, test_index_page_text, status_code=503) self.assertTemplateUsed(response, '503.html')
def test_maintenance_enable(self): Config.objects.create(key='maintenance', value=False) # First try, we go in maintenance maintenance.enable() self.assertTrue(Config.objects.get(key='maintenance').value) # Second try, nothing is changed now maintenance.enable() self.assertTrue(Config.objects.get(key='maintenance').value)
def test_admin_sees_warning_in_maintenance_mode_on_html_pages(self): admin_warning = 'Site is on maintenance' self.create_admin_and_login() response = self.client.get('/') self.assertNotContains(response, admin_warning) maintenance.enable() response = self.client.get('/') self.assertContains(response, admin_warning)
def test_maintenance_enable(self): Config.objects.create(key='maintenance', value=False) # First try, we go in maintenance maintenance.enable() self.assertTrue(Config.objects.get(key='maintenance').value) # Second try, nothing is changed now maintenance.enable() self.assertTrue(Config.objects.get(key='maintenance').value)
def test_admin_sees_warning_in_maintenance_mode_on_html_pages(self): admin_warning = 'Site is on maintenance' self.create_admin_and_login() response = self.client.get('/') self.assertNotContains(response, admin_warning) maintenance.enable() response = self.client.get('/') self.assertContains(response, admin_warning)
def test_maintenance_enable_empty_table(self): maintenance.enable() self.assertTrue(Config.objects.get(key='maintenance').value)
def test_no_warnings_for_admin_on_non_html_pages(self): admin_warning = 'Site is on maintenance' self.create_admin_and_login() maintenance.enable() response = self.client.get('/plaintext/') self.assertNotContains(response, admin_warning)
def test_maintenance_enable_empty_table(self): maintenance.enable() self.assertTrue(Config.objects.get(key='maintenance').value)
def test_no_warnings_for_admin_on_non_html_pages(self): admin_warning = 'Site is on maintenance' self.create_admin_and_login() maintenance.enable() response = self.client.get('/plaintext/') self.assertNotContains(response, admin_warning)