Restructured pages
This commit is contained in:
@@ -271,6 +271,11 @@ class IndexViewTests(AuthTestCase):
|
||||
response = self.client.get('/')
|
||||
self.assertContains(response, '/admin/')
|
||||
|
||||
def test_index_contains_search_input(self):
|
||||
"""Index page should contain search input."""
|
||||
response = self.client.get('/')
|
||||
self.assertContains(response, 'id="search-input"')
|
||||
|
||||
def test_index_requires_login(self):
|
||||
"""Index page should redirect to login if not authenticated."""
|
||||
self.client.logout()
|
||||
@@ -486,26 +491,21 @@ class ThingDetailViewTests(AuthTestCase):
|
||||
self.assertContains(response, f'/thing/{self.thing.id}/edit/')
|
||||
|
||||
|
||||
class SearchViewTests(AuthTestCase):
|
||||
"""Tests for search view."""
|
||||
class BoxesListViewTests(AuthTestCase):
|
||||
"""Tests for boxes list view."""
|
||||
|
||||
def test_search_returns_200(self):
|
||||
"""Search page should return 200 status."""
|
||||
def test_boxes_list_returns_200(self):
|
||||
"""Boxes list page should return 200 status."""
|
||||
response = self.client.get('/search/')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
def test_search_contains_search_input(self):
|
||||
"""Search page should contain search input field."""
|
||||
def test_boxes_list_contains_boxes_header(self):
|
||||
"""Boxes list page should contain boxes header."""
|
||||
response = self.client.get('/search/')
|
||||
self.assertContains(response, 'id="search-input"')
|
||||
self.assertContains(response, 'Boxes')
|
||||
|
||||
def test_search_contains_results_container(self):
|
||||
"""Search page should contain results table."""
|
||||
response = self.client.get('/search/')
|
||||
self.assertContains(response, 'id="results-container"')
|
||||
|
||||
def test_search_requires_login(self):
|
||||
"""Search page should redirect to login if not authenticated."""
|
||||
def test_boxes_list_requires_login(self):
|
||||
"""Boxes list page should redirect to login if not authenticated."""
|
||||
self.client.logout()
|
||||
response = self.client.get('/search/')
|
||||
self.assertRedirects(response, '/login/?next=/search/')
|
||||
|
||||
Reference in New Issue
Block a user