diff --git a/oxfordpython/tests.py b/oxfordpython/tests.py new file mode 100644 index 0000000..d8ed1e3 --- /dev/null +++ b/oxfordpython/tests.py @@ -0,0 +1,17 @@ +from django.test import Client +from django.test import TestCase + +class UrlRouteTests(TestCase): + + def setup(self): + self.client = Client() + + def test_home_page_is_accessible(self): + # tests that '' response is 200 + response = self.client.get('') + self.assertIs(response.status_code, 200) + + def test_admin_page_is_accessible(self): + # tests that 'admin/' response is 200 + response = self.client.get('admin/') + self.assertIs(response.status_code, 200) diff --git a/oxfordpython/urls.py b/oxfordpython/urls.py index 08d2709..8a9c343 100644 --- a/oxfordpython/urls.py +++ b/oxfordpython/urls.py @@ -1,9 +1,9 @@ -from django.conf.urls import url +from django.urls import path from django.contrib import admin from .main import views as main_views urlpatterns = [ - url(r'^admin/', admin.site.urls), - url(r'^$', main_views.HomeView.as_view(), name='home'), + path('admin/', admin.site.urls), + path('', main_views.HomeView.as_view(), name='home'), ]