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

first test urls

parent 004f0eb9
...@@ -31,3 +31,19 @@ JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't fin ...@@ -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 ###!!! [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/test.py
from django.urls import resolve
from django.test import TestCase 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.
# This file is to be created inside the lists app folder
# lists/urls.py
from django.conf.urls import url
from .views import home_page
urlpatterns = [
url(r'^$', home_page, name='home_page'),
]
\ No newline at end of file
# heroes/views.py
from django.shortcuts import render from django.shortcuts import render
# Create your views here. def home_page(request):
return render(request, 'home.html')
def detail_cloud(request):
return render(request, 'cloud.html')
def detail_sunflowey(request):
return render(request, 'sunflowey.html')
def detail_jester(request):
return render(request, 'jester.html')
...@@ -19,13 +19,22 @@ class NewVisitorTest(unittest.TestCase): ...@@ -19,13 +19,22 @@ class NewVisitorTest(unittest.TestCase):
# She sees a list containing three heroes with their corresponding # She sees a list containing three heroes with their corresponding
# names, health points, and damage # 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 # When she selects one of the heroes, she is sent to another page
# containing more information about the hero (additional stats, lore, image). # 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. # 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". # 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. # She clicks this and she is redirected back to the wiki's homepage.
#test for redirect thingo
self.fail('Finish the test!') self.fail('Finish the test!')
\ No newline at end of file
...@@ -13,9 +13,12 @@ Including another URLconf ...@@ -13,9 +13,12 @@ Including another URLconf
1. Import the include() function: from django.conf.urls import url, include 1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 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 from django.contrib import admin
urlpatterns = [ urlpatterns = [
url(r'^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