Add basic homepage test
This commit is contained in:
parent
a0cddae1c7
commit
aa54319778
4 changed files with 17 additions and 5 deletions
|
@ -4,7 +4,10 @@ set -e
|
||||||
|
|
||||||
export PATH=env/bin:${PATH}
|
export PATH=env/bin:${PATH}
|
||||||
|
|
||||||
coverage run manage.py test $@
|
coverage run --source=website manage.py test $@
|
||||||
|
|
||||||
|
coverage report
|
||||||
|
coverage html
|
||||||
|
|
||||||
echo "> Running formatter..."
|
echo "> Running formatter..."
|
||||||
black website/ --check
|
black website/ --check
|
||||||
|
|
|
@ -14,6 +14,3 @@ force_grid_wrap=0
|
||||||
use_parentheses=True
|
use_parentheses=True
|
||||||
line_length=88
|
line_length=88
|
||||||
not_skip=__init__.py
|
not_skip=__init__.py
|
||||||
|
|
||||||
[coverage:run]
|
|
||||||
source = "website"
|
|
||||||
|
|
12
website/common/tests.py
Normal file
12
website/common/tests.py
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
from django.test import SimpleTestCase
|
||||||
|
from django.urls import reverse
|
||||||
|
|
||||||
|
|
||||||
|
class BaseTestCase(SimpleTestCase):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class HomepageViewTestCase(BaseTestCase):
|
||||||
|
def test_accessible(self):
|
||||||
|
response = self.client.get(reverse("homepage"))
|
||||||
|
self.assertEqual(response.status_code, 200)
|
|
@ -2,4 +2,4 @@ from django.urls import path
|
||||||
|
|
||||||
from . import views
|
from . import views
|
||||||
|
|
||||||
urlpatterns = [path("", views.HomepageView.as_view())]
|
urlpatterns = [path("", views.HomepageView.as_view(), name="homepage")]
|
||||||
|
|
Reference in a new issue