Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CSCI 40 Midterm Project
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
Li Niko M. Arceo
CSCI 40 Midterm Project
Commits
1cc22fd8
Commit
1cc22fd8
authored
Mar 14, 2020
by
Li Niko M. Arceo
🦈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
functional test added, templates redesigned
parent
5d77ac55
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
307 additions
and
34 deletions
+307
-34
tests.cpython-38.pyc
froyo/__pycache__/tests.cpython-38.pyc
+0
-0
home.html
froyo/templates/home.html
+23
-1
ingredients_create_form.html
froyo/templates/ingredients_create_form.html
+8
-0
ingredients_detail.html
froyo/templates/ingredients_detail.html
+8
-0
ingredients_list.html
froyo/templates/ingredients_list.html
+8
-0
ingredients_update_form.html
froyo/templates/ingredients_update_form.html
+8
-0
orders_create_form.html
froyo/templates/orders_create_form.html
+8
-0
orders_detail.html
froyo/templates/orders_detail.html
+8
-0
orders_list.html
froyo/templates/orders_list.html
+8
-0
orders_update_form.html
froyo/templates/orders_update_form.html
+8
-0
recipes_create_form.html
froyo/templates/recipes_create_form.html
+8
-0
recipes_detail.html
froyo/templates/recipes_detail.html
+8
-0
recipes_list.html
froyo/templates/recipes_list.html
+8
-0
recipes_update_form.html
froyo/templates/recipes_update_form.html
+8
-0
tests.py
froyo/tests.py
+6
-33
functional_test.py
functional_test.py
+182
-0
No files found.
froyo/__pycache__/tests.cpython-38.pyc
View file @
1cc22fd8
No preview for this file type
froyo/templates/home.html
View file @
1cc22fd8
<html>
<html>
<title>
Home
</title>
<head>
<title>
The Good Place FroYo Shop - Home
</title>
</head>
<body>
<h1>
The Good Place FroYo Shop - Home
</h1>
<dl>
<dt>
Ingredients
</dt>
<dd>
List
</dd>
<dd>
Detail
</dd>
<dd>
Update Form
</dd>
<dd>
Create Form
</dd>
<dt>
Recipes
</dt>
<dd>
List
</dd>
<dd>
Detail
</dd>
<dd>
Update Form
</dd>
<dd>
Create Form
</dd>
<dt>
Orders
</dt>
<dd>
List
</dd>
<dd>
Detail
</dd>
<dd>
Update Form
</dd>
<dd>
Create Form
</dd>
</dl>
</body>
</html>
</html>
\ No newline at end of file
froyo/templates/ingredients_create_form.html
View file @
1cc22fd8
<html>
<html>
<head>
<title>
Ingredients - Create
</title>
<title>
Ingredients - Create
</title>
</head>
<body>
<h1>
Ingredients - Create
</h1>
<dl>
<dt>
Back to Home
</dt>
</dl>
</body>
</html>
</html>
\ No newline at end of file
froyo/templates/ingredients_detail.html
View file @
1cc22fd8
<html>
<html>
<head>
<title>
Ingredients - Detail
</title>
<title>
Ingredients - Detail
</title>
</head>
<body>
<h1>
Ingredients - Detail
</h1>
<dl>
<dt>
Back to Home
</dt>
</dl>
</body>
</html>
</html>
\ No newline at end of file
froyo/templates/ingredients_list.html
View file @
1cc22fd8
<html>
<html>
<head>
<title>
Ingredients - List
</title>
<title>
Ingredients - List
</title>
</head>
<body>
<h1>
Ingredients - List
</h1>
<dl>
<dt>
Back to Home
</dt>
</dl>
</body>
</html>
</html>
\ No newline at end of file
froyo/templates/ingredients_update_form.html
View file @
1cc22fd8
<html>
<html>
<head>
<title>
Ingredients - Update
</title>
<title>
Ingredients - Update
</title>
</head>
<body>
<h1>
Ingredients - Update
</h1>
<dl>
<dt>
Back to Home
</dt>
</dl>
</body>
</html>
</html>
\ No newline at end of file
froyo/templates/orders_create_form.html
View file @
1cc22fd8
<html>
<html>
<head>
<title>
Orders - Create
</title>
<title>
Orders - Create
</title>
</head>
<body>
<h1>
Orders - Create
</h1>
<dl>
<dt>
Back to Home
</dt>
</dl>
</body>
</html>
</html>
\ No newline at end of file
froyo/templates/orders_detail.html
View file @
1cc22fd8
<html>
<html>
<head>
<title>
Orders - Detail
</title>
<title>
Orders - Detail
</title>
</head>
<body>
<h1>
Orders - Detail
</h1>
<dl>
<dt>
Back to Home
</dt>
</dl>
</body>
</html>
</html>
\ No newline at end of file
froyo/templates/orders_list.html
View file @
1cc22fd8
<html>
<html>
<head>
<title>
Orders - List
</title>
<title>
Orders - List
</title>
</head>
<body>
<h1>
Orders - List
</h1>
<dl>
<dt>
Back to Home
</dt>
</dl>
</body>
</html>
</html>
\ No newline at end of file
froyo/templates/orders_update_form.html
View file @
1cc22fd8
<html>
<html>
<head>
<title>
Orders - Update
</title>
<title>
Orders - Update
</title>
</head>
<body>
<h1>
Orders - Update
</h1>
<dl>
<dt>
Back to Home
</dt>
</dl>
</body>
</html>
</html>
\ No newline at end of file
froyo/templates/recipes_create_form.html
View file @
1cc22fd8
<html>
<html>
<head>
<title>
Recipes - Create
</title>
<title>
Recipes - Create
</title>
</head>
<body>
<h1>
Recipes - Create
</h1>
<dl>
<dt>
Back to Home
</dt>
</dl>
</body>
</html>
</html>
\ No newline at end of file
froyo/templates/recipes_detail.html
View file @
1cc22fd8
<html>
<html>
<head>
<title>
Recipes - Detail
</title>
<title>
Recipes - Detail
</title>
</head>
<body>
<h1>
Recipes - Detail
</h1>
<dl>
<dt>
Back to Home
</dt>
</dl>
</body>
</html>
</html>
\ No newline at end of file
froyo/templates/recipes_list.html
View file @
1cc22fd8
<html>
<html>
<head>
<title>
Recipes - List
</title>
<title>
Recipes - List
</title>
</head>
<body>
<h1>
Recipes - List
</h1>
<dl>
<dt>
Back to Home
</dt>
</dl>
</body>
</html>
</html>
\ No newline at end of file
froyo/templates/recipes_update_form.html
View file @
1cc22fd8
<html>
<html>
<head>
<title>
Recipes - Update
</title>
<title>
Recipes - Update
</title>
</head>
<body>
<h1>
Recipes - Update
</h1>
<dl>
<dt>
Back to Home
</dt>
</dl>
</body>
</html>
</html>
\ No newline at end of file
froyo/tests.py
View file @
1cc22fd8
from
django.test
import
TestCase
from
django.test
import
TestCase
class
HomePage
Test
(
TestCase
):
class
Views
Test
(
TestCase
):
def
test_uses_home_template
(
self
):
def
test_uses_home_template
(
self
):
response
=
self
.
client
.
get
(
'/'
)
response
=
self
.
client
.
get
(
'/'
)
self
.
assertTemplateUsed
(
response
,
'home.html'
)
self
.
assertTemplateUsed
(
response
,
'home.html'
)
#ingredients tests
class
IngredientsListTest
(
TestCase
):
def
test_uses_ingredients_list_template
(
self
):
def
test_uses_ingredients_list_template
(
self
):
response
=
self
.
client
.
get
(
'/ingredients/list'
)
response
=
self
.
client
.
get
(
'/ingredients/list'
)
self
.
assertTemplateUsed
(
response
,
'ingredients_list.html'
)
self
.
assertTemplateUsed
(
response
,
'ingredients_list.html'
)
class
IngredientsDetailTest
(
TestCase
):
def
test_uses_ingredients_detail_template
(
self
):
def
test_uses_ingredients_detail_template
(
self
):
response
=
self
.
client
.
get
(
'/ingredients/detail'
)
response
=
self
.
client
.
get
(
'/ingredients/detail'
)
self
.
assertTemplateUsed
(
response
,
'ingredients_detail.html'
)
self
.
assertTemplateUsed
(
response
,
'ingredients_detail.html'
)
class
IngredientsUpdateTest
(
TestCase
):
def
test_uses_ingredients_update_template
(
self
):
def
test_uses_ingredients_update_template
(
self
):
response
=
self
.
client
.
get
(
'/ingredients/update'
)
response
=
self
.
client
.
get
(
'/ingredients/update'
)
self
.
assertTemplateUsed
(
response
,
'ingredients_update_form.html'
)
self
.
assertTemplateUsed
(
response
,
'ingredients_update_form.html'
)
class
IngredientsCreateTest
(
TestCase
):
def
test_uses_ingredients_create_template
(
self
):
def
test_uses_ingredients_create_template
(
self
):
response
=
self
.
client
.
get
(
'/ingredients/create'
)
response
=
self
.
client
.
get
(
'/ingredients/create'
)
self
.
assertTemplateUsed
(
response
,
'ingredients_create_form.html'
)
self
.
assertTemplateUsed
(
response
,
'ingredients_create_form.html'
)
#recipes tests
class
RecipesListTest
(
TestCase
):
def
test_uses_recipes_list_template
(
self
):
def
test_uses_recipes_list_template
(
self
):
response
=
self
.
client
.
get
(
'/recipes/list'
)
response
=
self
.
client
.
get
(
'/recipes/list'
)
self
.
assertTemplateUsed
(
response
,
'recipes_list.html'
)
self
.
assertTemplateUsed
(
response
,
'recipes_list.html'
)
class
RecipesDetailTest
(
TestCase
):
def
test_uses_recipes_detail_template
(
self
):
def
test_uses_recipes_detail_template
(
self
):
response
=
self
.
client
.
get
(
'/recipes/detail'
)
response
=
self
.
client
.
get
(
'/recipes/detail'
)
self
.
assertTemplateUsed
(
response
,
'recipes_detail.html'
)
self
.
assertTemplateUsed
(
response
,
'recipes_detail.html'
)
class
RecipesUpdateTest
(
TestCase
):
def
test_uses_recipes_update_template
(
self
):
def
test_uses_recipes_update_template
(
self
):
response
=
self
.
client
.
get
(
'/recipes/update'
)
response
=
self
.
client
.
get
(
'/recipes/update'
)
self
.
assertTemplateUsed
(
response
,
'recipes_update_form.html'
)
self
.
assertTemplateUsed
(
response
,
'recipes_update_form.html'
)
class
RecipesCreateTest
(
TestCase
):
def
test_uses_recipes_create_template
(
self
):
def
test_uses_recipes_create_template
(
self
):
response
=
self
.
client
.
get
(
'/recipes/create'
)
response
=
self
.
client
.
get
(
'/recipes/create'
)
self
.
assertTemplateUsed
(
response
,
'recipes_create_form.html'
)
self
.
assertTemplateUsed
(
response
,
'recipes_create_form.html'
)
#orders tests
class
OrdersListTest
(
TestCase
):
def
test_uses_orders_list_template
(
self
):
def
test_uses_orders_list_template
(
self
):
response
=
self
.
client
.
get
(
'/orders/list'
)
response
=
self
.
client
.
get
(
'/orders/list'
)
self
.
assertTemplateUsed
(
response
,
'orders_list.html'
)
self
.
assertTemplateUsed
(
response
,
'orders_list.html'
)
class
OrdersDetailTest
(
TestCase
):
def
test_uses_orders_detail_template
(
self
):
def
test_uses_orders_detail_template
(
self
):
response
=
self
.
client
.
get
(
'/orders/detail'
)
response
=
self
.
client
.
get
(
'/orders/detail'
)
self
.
assertTemplateUsed
(
response
,
'orders_detail.html'
)
self
.
assertTemplateUsed
(
response
,
'orders_detail.html'
)
class
OrdersUpdateTest
(
TestCase
):
def
test_uses_orders_update_template
(
self
):
def
test_uses_orders_update_template
(
self
):
response
=
self
.
client
.
get
(
'/orders/update'
)
response
=
self
.
client
.
get
(
'/orders/update'
)
self
.
assertTemplateUsed
(
response
,
'orders_update_form.html'
)
self
.
assertTemplateUsed
(
response
,
'orders_update_form.html'
)
class
OrdersCreateTest
(
TestCase
):
def
test_uses_orders_create_template
(
self
):
def
test_uses_orders_create_template
(
self
):
response
=
self
.
client
.
get
(
'/orders/create'
)
response
=
self
.
client
.
get
(
'/orders/create'
)
self
.
assertTemplateUsed
(
response
,
'orders_create_form.html'
)
self
.
assertTemplateUsed
(
response
,
'orders_create_form.html'
)
\ No newline at end of file
functional_test.py
0 → 100644
View file @
1cc22fd8
from
selenium
import
webdriver
import
unittest
import
time
class
NewVisitorTest
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
browser
=
webdriver
.
Firefox
()
def
tearDown
(
self
):
self
.
browser
.
quit
()
def
test_can_display_a_heroes_list_and_more_information_per_hero
(
self
):
browser
.
get
(
'http://localhost:8000'
)
# check homepage title
self
.
assertIn
(
'The Good Place FroYo Shop - Home'
,
self
.
browser
.
title
)
# check to see list of each model, having 4 links for each view underneath
model_list
=
self
.
browser
.
find_element_by_id
(
'model_list'
)
self
.
assertEqual
(
'ul'
,
model_list
.
tag_name
)
# check if each link leads to its corresponding view
#ingredients views
link
=
self
.
browser
.
find_element_by_id
(
'ingredients-list'
)
link
.
click
()
time
.
sleep
(
1
)
self
.
assertEqual
(
'http://localhost:8000/ingredients/list'
,
self
.
browser
.
getCurrentUrl
()
)
link
=
self
.
browser
.
find_element_by_id
(
'ingredients-detail'
)
link
.
click
()
time
.
sleep
(
1
)
self
.
assertEqual
(
'http://localhost:8000/ingredients/detail'
,
self
.
browser
.
getCurrentUrl
()
)
link
=
self
.
browser
.
find_element_by_id
(
'ingredients-update'
)
link
.
click
()
time
.
sleep
(
1
)
self
.
assertEqual
(
'http://localhost:8000/ingredients/update'
,
self
.
browser
.
getCurrentUrl
()
)
link
=
self
.
browser
.
find_element_by_id
(
'ingredients-create'
)
link
.
click
()
time
.
sleep
(
1
)
self
.
assertEqual
(
'http://localhost:8000/ingredients/create'
,
self
.
browser
.
getCurrentUrl
()
)
#recipes views
link
=
self
.
browser
.
find_element_by_id
(
'recipes-list'
)
link
.
click
()
time
.
sleep
(
1
)
self
.
assertEqual
(
'http://localhost:8000/recipes/list'
,
self
.
browser
.
getCurrentUrl
()
)
link
=
self
.
browser
.
find_element_by_id
(
'recipes-detail'
)
link
.
click
()
time
.
sleep
(
1
)
self
.
assertEqual
(
'http://localhost:8000/recipes/detail'
,
self
.
browser
.
getCurrentUrl
()
)
link
=
self
.
browser
.
find_element_by_id
(
'recipes-update'
)
link
.
click
()
time
.
sleep
(
1
)
self
.
assertEqual
(
'http://localhost:8000/recipes/update'
,
self
.
browser
.
getCurrentUrl
()
)
link
=
self
.
browser
.
find_element_by_id
(
'recipes-create'
)
link
.
click
()
time
.
sleep
(
1
)
self
.
assertEqual
(
'http://localhost:8000/recipes/create'
,
self
.
browser
.
getCurrentUrl
()
)
#orders views
link
=
self
.
browser
.
find_element_by_id
(
'orders-list'
)
link
.
click
()
time
.
sleep
(
1
)
self
.
assertEqual
(
'http://localhost:8000/orders/list'
,
self
.
browser
.
getCurrentUrl
()
)
link
=
self
.
browser
.
find_element_by_id
(
'orders-detail'
)
link
.
click
()
time
.
sleep
(
1
)
self
.
assertEqual
(
'http://localhost:8000/orders/detail'
,
self
.
browser
.
getCurrentUrl
()
)
link
=
self
.
browser
.
find_element_by_id
(
'orders-update'
)
link
.
click
()
time
.
sleep
(
1
)
self
.
assertEqual
(
'http://localhost:8000/orders/update'
,
self
.
browser
.
getCurrentUrl
()
)
link
=
self
.
browser
.
find_element_by_id
(
'orders-create'
)
link
.
click
()
time
.
sleep
(
1
)
self
.
assertEqual
(
'http://localhost:8000/orders/create'
,
self
.
browser
.
getCurrentUrl
()
)
# check page title of each view
self
.
browser
.
get
(
'http://localhost:8000/ingredients/list'
)
self
.
assertIn
(
'Ingredients - List'
,
self
.
browser
.
title
)
self
.
browser
.
get
(
'http://localhost:8000/ingredients/detail'
)
self
.
assertIn
(
'Ingredients - Details'
,
self
.
browser
.
title
)
self
.
browser
.
get
(
'http://localhost:8000/ingredients/update'
)
self
.
assertIn
(
'Ingredients - Update'
,
self
.
browser
.
title
)
self
.
browser
.
get
(
'http://localhost:8000/ingredients/create'
)
self
.
assertIn
(
'Ingredients - Create'
,
self
.
browser
.
title
)
self
.
browser
.
get
(
'http://localhost:8000/recipes/list'
)
self
.
assertIn
(
'Recipes - List'
,
self
.
browser
.
title
)
self
.
browser
.
get
(
'http://localhost:8000/recipes/detail'
)
self
.
assertIn
(
'Recipes - Details'
,
self
.
browser
.
title
)
self
.
browser
.
get
(
'http://localhost:8000/recipes/update'
)
self
.
assertIn
(
'Recipes - Update'
,
self
.
browser
.
title
)
self
.
browser
.
get
(
'http://localhost:8000/recipes/create'
)
self
.
assertIn
(
'Recipes - Create'
,
self
.
browser
.
title
)
self
.
browser
.
get
(
'http://localhost:8000/orders/list'
)
self
.
assertIn
(
'Orders - List'
,
self
.
browser
.
title
)
self
.
browser
.
get
(
'http://localhost:8000/orders/detail'
)
self
.
assertIn
(
'Orders - Details'
,
self
.
browser
.
title
)
self
.
browser
.
get
(
'http://localhost:8000/orders/update'
)
self
.
assertIn
(
'Orders - Update'
,
self
.
browser
.
title
)
self
.
browser
.
get
(
'http://localhost:8000/orders/create'
)
self
.
assertIn
(
'Orders - Create'
,
self
.
browser
.
title
)
# check if back to homepage button works
back_button
=
self
.
browser
.
find_element_by_id
(
'back_button'
)
self
.
assertEqual
(
'Back to Home'
,
back_button
.
text
)
back_button
.
click
()
time
.
sleep
(
1
)
self
.
fail
(
'Finish the test!'
)
\ No newline at end of file
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