Commit bb974645 authored by Karlo Cabugwang's avatar Karlo Cabugwang

added homeview

parent 620e54aa
Pipeline #1133 failed with stages
from django.urls import resolve
from django.test import TestCase
from .views import *
class HomeViewTest(TestCase):
def test_can_open_home_view_temp(self):
response = self.client.get('/')
self.assertTemplateUsed(response, 'home.html')
class IngredientsListViewTest(TestCase):
def test_can_open_ingredients_list_view_temp(self):
......
......@@ -4,6 +4,7 @@ from .views import *
urlpatterns = [
url(r'^$', HomeView.as_view(), name='home'),
url(r'^ingredients$', IngredientsListView.as_view(), name='ingredients_list'),
url(r'^ingredients/detail$', IngredientsDetailView.as_view(), name='ingredients_detail'),
url(r'^ingredients/new$', IngredientsCreateView.as_view(), name='ingredients_create'),
......
from django.views.generic.base import TemplateView
from .models import *
class HomeView(TemplateView):
template_name = "home.html"
class IngredientsListView(TemplateView):
template_name = "ingredients_list.html"
......
import unittest
import time
from selenium import webdriver
......@@ -11,9 +12,30 @@ class NewVisitorTest(unittest.TestCase):
def tearDown(self):
self.browser.quit()
def test_can_start(self):
def test_can_display_home_and_go_to_ingredients(self):
self.browser.get('http://localhost:8000')
self.assertIn('To-Do',self.browser.title)
self.assertIn('The Good Place Froyo Shop',self.browser.title)
model_list = self.browser.find_element_by_id('model_list')
self.assertEqual(
'ul',
model_list.tag_name
)
ingredients_page = self.browser.find_element_by_id('ingredients')
ingredients_page.click()
time.sleep(1)
self.assertEqual(
"http://localhost:8000/ingredients",
self.browser.getCurrentUrl()
)
self.assertIn('Ingredients - List', self.browser.title)
self.fail('Finish the test')
......
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