Make tests pass on home page
This commit is contained in:
parent
3fad961353
commit
292c97c64f
|
@ -145,4 +145,4 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
|||
# Simplified static file serving.
|
||||
# https://warehouse.python.org/project/whitenoise/
|
||||
|
||||
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
|
||||
#STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
|
||||
|
|
|
@ -1,9 +1,25 @@
|
|||
from django.contrib.auth import get_user_model
|
||||
from django.test import TestCase
|
||||
from django.urls import reverse
|
||||
|
||||
|
||||
USER = get_user_model()
|
||||
|
||||
|
||||
class HomeTests(TestCase):
|
||||
def test_home_view_status_code(self):
|
||||
def setUp(self):
|
||||
self.user = USER.objects.create(
|
||||
username="jbond", email="james@hms.co.uk", password="007"
|
||||
)
|
||||
|
||||
def test_home_view_anonymous_redirected_statuts_code(self):
|
||||
url = reverse("home")
|
||||
response = self.client.get(url)
|
||||
self.assertEquals(response.status_code, 302)
|
||||
|
||||
def test_home_view_status_code_with_user_connected(self):
|
||||
login_result = self.client.login(username="jbond", password="007")
|
||||
|
||||
url = reverse("home")
|
||||
response = self.client.get(url, follow=True)
|
||||
self.assertEquals(response.status_code, 200)
|
||||
|
|
|
@ -5,12 +5,6 @@ from django.urls import reverse
|
|||
|
||||
from ultron.people.models import Gymnast
|
||||
|
||||
class HomeTests(TestCase):
|
||||
def test_home_view_status_code(self):
|
||||
url = reverse("home")
|
||||
response = self.client.get(url)
|
||||
self.assertEquals(response.status_code, 200)
|
||||
|
||||
|
||||
class GymnastTestCase(TestCase):
|
||||
def test_gymnast_tostring(self):
|
||||
|
|
Loading…
Reference in New Issue