Commit fbfc431c authored by Li Niko M. Arceo's avatar Li Niko M. Arceo 🦈

Unittest for homepage works

parent 9d25cfd4
from django.urls import resolve
from django.test import TestCase
# Create your tests here.
from .views import HomeView
class HomePageTest(TestCase):
def test_root_url_resolves_to_home_page_view(self):
def test_uses_home_template(self):
response = self.client.get('/')
self.assertTemplateUsed(response,'home.html')
......@@ -8,6 +8,6 @@ urlpatterns = [
url(r'^$', HomeView.as_view(), name='home'),
url(r'^heroes$', HomeView.as_view(), name='heroes'),
url(r'^heroes/cloud$', CloudView.as_view(), name='cloud'),
url(r'^heroes/jester$', JesterView.as_view(), name='jester')
url(r'^heroes/sunflowey$', SunfloweyView.as_view(), name='sunflowey')
url(r'^heroes/jester$', JesterView.as_view(), name='jester'),
url(r'^heroes/sunflowey$', SunfloweyView.as_view(), name='sunflowey'),
]
......@@ -2,10 +2,10 @@ from django.views.generic.base import TemplateView
class HomeView(TemplateView):
template_name =
template_name = 'home.html'
class HeroesView(TemplateView):
template_name = 'home.html'
template_name = 'heroes.html'
class CloudView(TemplateView):
template_name = 'detail_cloud.html'
......
......@@ -37,6 +37,7 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'heroes',
]
MIDDLEWARE = [
......
......@@ -14,8 +14,9 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.conf.urls import url, include
urlpatterns = [
path('admin/', admin.site.urls),
url(r'^admin/', admin.site.urls),
url(r'', include('heroes.urls')),
]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment