Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
thegoodplace
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Karlo Cabugwang
thegoodplace
Commits
bb974645
Commit
bb974645
authored
Mar 18, 2020
by
Karlo Cabugwang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added homeview
parent
620e54aa
Pipeline
#1133
failed with stages
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
3 deletions
+34
-3
tests.py
froyo/tests.py
+7
-0
urls.py
froyo/urls.py
+1
-0
views.py
froyo/views.py
+2
-1
functional_test.py
functional_test.py
+24
-2
No files found.
froyo/tests.py
View file @
bb974645
from
django.urls
import
resolve
from
django.urls
import
resolve
from
django.test
import
TestCase
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
):
class
IngredientsListViewTest
(
TestCase
):
def
test_can_open_ingredients_list_view_temp
(
self
):
def
test_can_open_ingredients_list_view_temp
(
self
):
...
...
froyo/urls.py
View file @
bb974645
...
@@ -4,6 +4,7 @@ from .views import *
...
@@ -4,6 +4,7 @@ from .views import *
urlpatterns
=
[
urlpatterns
=
[
url
(
r'^$'
,
HomeView
.
as_view
(),
name
=
'home'
),
url
(
r'^ingredients$'
,
IngredientsListView
.
as_view
(),
name
=
'ingredients_list'
),
url
(
r'^ingredients$'
,
IngredientsListView
.
as_view
(),
name
=
'ingredients_list'
),
url
(
r'^ingredients/detail$'
,
IngredientsDetailView
.
as_view
(),
name
=
'ingredients_detail'
),
url
(
r'^ingredients/detail$'
,
IngredientsDetailView
.
as_view
(),
name
=
'ingredients_detail'
),
url
(
r'^ingredients/new$'
,
IngredientsCreateView
.
as_view
(),
name
=
'ingredients_create'
),
url
(
r'^ingredients/new$'
,
IngredientsCreateView
.
as_view
(),
name
=
'ingredients_create'
),
...
...
froyo/views.py
View file @
bb974645
from
django.views.generic.base
import
TemplateView
from
django.views.generic.base
import
TemplateView
from
.models
import
*
class
HomeView
(
TemplateView
):
template_name
=
"home.html"
class
IngredientsListView
(
TemplateView
):
class
IngredientsListView
(
TemplateView
):
template_name
=
"ingredients_list.html"
template_name
=
"ingredients_list.html"
...
...
functional_test.py
View file @
bb974645
import
unittest
import
unittest
import
time
from
selenium
import
webdriver
from
selenium
import
webdriver
...
@@ -11,9 +12,30 @@ class NewVisitorTest(unittest.TestCase):
...
@@ -11,9 +12,30 @@ class NewVisitorTest(unittest.TestCase):
def
tearDown
(
self
):
def
tearDown
(
self
):
self
.
browser
.
quit
()
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
.
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'
)
self
.
fail
(
'Finish the test'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment