Commit b703a2fa authored by Lance Michael O. Co's avatar Lance Michael O. Co 😢

Merge branch '$urls' into 'master'

$urls

See merge request !1
parents 004f0eb9 2039c510
......@@ -31,3 +31,19 @@ JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't fin
###!!! [Child][MessageChannel::SendAndWait] Error: Channel error: cannot send/recv
1583580526682 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "-marionette" "-foreground" "-no-remote" "-profile" "C:\\Users\\Acer\\AppData\\Local\\Temp\\rust_mozprofileALnWTP"
1583580527095 addons.webextension.doh-rollout@mozilla.org WARN Loading extension 'doh-rollout@mozilla.org': Reading manifest: Invalid extension permission: networkStatus
1583580527422 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: mozillaAddons
1583580527422 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: telemetry
1583580527422 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: resource://pdf.js/
1583580527423 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: about:reader*
JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory.
1583580529086 Marionette INFO Listening on port 57285
1583580529301 Marionette WARN TLS certificate errors will be ignored for this session
1583580532315 Marionette INFO Stopped listening on port 57285
###!!! [Child][RunMessage] Error: Channel closing: too late to send/recv, messages will be lost
###!!! [Child][MessageChannel::SendAndWait] Error: Channel error: cannot send/recv
<!-- heroes/templates/home.html -->
<html>
<title>To-Do heroes</title>
</html>
\ No newline at end of file
# heroes/test.py
from django.urls import resolve
from django.test import TestCase
from django.http import HttpRequest
from .views import home_page
class HomePageTest(TestCase):
def test_root_url_resolves_to_home_page_view(self):
found = resolve('/')
self.assertEqual(found.func, home_page)
def test_home_page_returns_correct_html(self):
request = HttpRequest()
response = home_page(request)
html = response.content.decode('utf8')
self.assertTrue(html.startswith('<html>'))
self.assertIn('<title>To-Do lists</title>', html)
self.assertTrue(html.endswith('</html>'))
# Create your tests here.
# heroes/urls.py
from django.conf.urls import url
from .views import HomeView, HeroesView, CloudView, SunfloweyView, JesterView
urlpatterns = [
url(r'^/$', HomeView, name='home'),
url(r'^/heroes/$', HeroesView, name='heroes'),
url(r'/hero/cloud/^$', CloudView, name='cloud'),
url(r'/hero/sunflowey/^$', SunfloweyView, name='sunflowey'),
url(r'/hero/jester/^$', JesterView, name='jester'),
]
\ No newline at end of file
from django.shortcuts import render
# heroes/views.py
from django.views.generic.base import TemplateView
from django.views.generic.edit import CreateView
# Create your views here.
class HomeView(TemplateView):
template_name = "home.html"
class HeroesView(TemplateView):
template_name = "heroes.html"
class CloudView(TemplateView):
template_name = "cloud.html"
class SunfloweyView(TemplateView):
template_name = "sunflowey.html"
class JesterView(TemplateView):
template_name = "jester.html"
......@@ -19,13 +19,22 @@ class NewVisitorTest(unittest.TestCase):
# She sees a list containing three heroes with their corresponding
# names, health points, and damage
self.browser.get('http://localhost:8000/heroes')
input = self.browser.find_element_by_id('id_new_item')
self.assertEqual(input.get_attribute('placeholder'), 'Enter a to-do item')
# When she selects one of the heroes, she is sent to another page
# containing more information about the hero (additional stats, lore, image).
#test for the urls and others
# She spots the page title and header mentions the name of the hero she selected.
self.assertIn(hero, self.browser.title)
# While she is in a specific hero's page, she sees a button labeled "Back to Heroes List".
# She clicks this and she is redirected back to the wiki's homepage.
#test for redirect thingo
self.fail('Finish the test!')
\ No newline at end of file
......@@ -13,9 +13,12 @@ Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url
#superlists/urls.py
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
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