Commit c0e44b8c authored by Coltrane Torres's avatar Coltrane Torres

Initial commit

parent ee705ed2
Pipeline #1167 failed with stages
from django.contrib import admin
# Register your models here.
from django.apps import AppConfig
class FroyoConfig(AppConfig):
name = 'froyo'
from django.db import models
# Create your models here.
<html>
<head>
<title>The Good Place FroYo Shop Home Page</title>
</head>
<body>
<h1>The Good Place FroYo Shop</h1>
<a id = "Ingredients" href='http://localhost:8000/home/ingredients/'>Ingredients</a>
<a id = "Recipes" href='http://localhost:8000/home/recipes/'>Recipes</a>
<a id = "Orders" href='http://localhost:8000/home/orders/'>Orders</a>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>Ingredients - Create</title>
</head>
<body>
<a id = "ingredientsCreateToList" href='http://localhost:8000/home/ingredients/'>Back to Ingredients List</a>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>Ingredients - Detail</title>
</head>
<body>
<a id = "ingredientsDetailToList" href='http://localhost:8000/home/ingredients/'>Back to Ingredients List</a>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>Ingredients - List</title>
</head>
<body>
<a id = "ingredientsDetail" href='http://localhost:8000/home/ingredients/detail/'>Ingredients Detail</a>
<a id = "ingredientsUpdate" href='http://localhost:8000/home/ingredients/update/'>Ingredients Update</a>
<a id = "ingredientsCreate" href='http://localhost:8000/home/ingredients/create/'>Ingredients Create</a>
<a id = "ingredientsListToHome" href='http://localhost:8000/home/'>Back to Froyo Home Page</a>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>Ingredients - Update</title>
</head>
<body>
<a id = "ingredientsUpdateToList" href='http://localhost:8000/home/ingredients/'>Back to Ingredients List</a>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>Orders - Create</title>
</head>
<body>
<a id = "ordersCreateToList" href='http://localhost:8000/home/orders/'>Back to Orders List</a>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>Orders - Detail</title>
</head>
<body>
<a id = "ordersDetailToList" href='http://localhost:8000/home/orders/'>Back to Orders List</a>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>Orders - List</title>
</head>
<body>
<a id = "ordersDetail" href='http://localhost:8000/home/orders/detail/'>Orders Detail</a>
<a id = "ordersUpdate" href='http://localhost:8000/home/orders/update/'>Orders Create</a>
<a id = "ordersCreate" href='http://localhost:8000/home/orders/create/'>Orders Update</a>
<a id = "ordersListToHome" href='http://localhost:8000/home'>Back to Froyo Home Page</a>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>Orders - Update</title>
</head>
<body>
<a id = "ordersUpdateToList" href='http://localhost:8000/home/orders/'>Back to Orders List</a>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>Recipes - Create</title>
</head>
<body>
<a id = "recipesCreateToList" href='http://localhost:8000/home/recipes/'>Back to Recipes List</a>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>Recipes - Detail</title>
</head>
<body>
<a id = "recipesDetailToList" href='http://localhost:8000/home/recipes/'>Back to Recipes List</a>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>Recipes - List</title>
</head>
<body>
<a id = "recipesDetail" href='http://localhost:8000/home/recipes/detail/'>Recipes Detail</a>
<a id = "recipesUpdate" href='http://localhost:8000/home/recipes/update/'>Recipes Create</a>
<a id = "recipesCreate" href='http://localhost:8000/home/recipes/create/'>Recipes Update</a>
<a id = "recipesListToHome" href='http://localhost:8000/home'>Back to Froyo Home Page</a>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>Recipes - Update</title>
</head>
<body>
<a id = "recipesUpdateToList" href='http://localhost:8000/home/recipes/'>Back to Recipes List</a>
</body>
</html>
\ No newline at end of file
from django.test import TestCase
from django.urls import resolve
from django.http import HttpRequest
from .views import HomePageView
from .views import IngredientsListView
from .views import IngredientsDetailView
from .views import IngredientsUpdateView
from .views import IngredientsCreateView
from .views import RecipesListView
from .views import RecipesDetailView
from .views import RecipesUpdateView
from .views import RecipesCreateView
from .views import OrdersListView
from .views import OrdersDetailView
from .views import OrdersUpdateView
from .views import OrdersCreateView
class FroyoListPageTest(TestCase):
def test_home_page(self):
response = self.client.get('/home/')
self.assertTemplateUsed(response, 'home.html')
def test_ingredients_list_page(self):
response = self.client.get('/home/ingredients/')
self.assertTemplateUsed(response, 'ingredients_list.html')
def test_ingredients_detail_page(self):
response = self.client.get('/home/ingredients/detail/')
self.assertTemplateUsed(response, 'ingredients_detail.html')
def test_ingredients_update_page(self):
response = self.client.get('/home/ingredients/update/')
self.assertTemplateUsed(response, 'ingredients_update_form.html')
def test_ingredients_create_page(self):
response = self.client.get('/home/ingredients/create/')
self.assertTemplateUsed(response, 'ingredients_create_form.html')
def test_recipes_list_page(self):
response = self.client.get('/home/recipes/')
self.assertTemplateUsed(response, 'recipes_list.html')
def test_recipes_detail_page(self):
response = self.client.get('/home/recipes/detail/')
self.assertTemplateUsed(response, 'recipes_detail.html')
def test_recipes_update_page(self):
response = self.client.get('/home/recipes/update/')
self.assertTemplateUsed(response, 'recipes_update_form.html')
def test_recipes_create_page(self):
response = self.client.get('/home/recipes/create/')
self.assertTemplateUsed(response, 'recipes_create_form.html')
def test_orders_list_page(self):
response = self.client.get('/home/orders/')
self.assertTemplateUsed(response, 'orders_list.html')
def test_orders_detail_page(self):
response = self.client.get('/home/orders/detail/')
self.assertTemplateUsed(response, 'orders_detail.html')
def test_orders_update_page(self):
response = self.client.get('/home/orders/update/')
self.assertTemplateUsed(response, 'orders_update_form.html')
def test_orders_create_page(self):
response = self.client.get('/home/orders/create/')
self.assertTemplateUsed(response, 'orders_create_form.html')
\ No newline at end of file
from django.urls import path
from .views import HomePageView
from .views import IngredientsListView
from .views import IngredientsDetailView
from .views import IngredientsUpdateView
from .views import IngredientsCreateView
from .views import RecipesListView
from .views import RecipesDetailView
from .views import RecipesUpdateView
from .views import RecipesCreateView
from .views import OrdersListView
from .views import OrdersDetailView
from .views import OrdersUpdateView
from .views import OrdersCreateView
urlpatterns = [
path('home/', HomePageView.as_view(), name= 'home'),
path('home/ingredients/', IngredientsListView.as_view(), name = 'home/ingredients'),
path('home/ingredients/detail/', IngredientsDetailView.as_view(), name = 'home/ingredients/detail'),
path('home/ingredients/update/', IngredientsUpdateView.as_view(), name = 'home/ingredients/update'),
path('home/ingredients/create/', IngredientsCreateView.as_view(), name = 'home/ingredients/create'),
path('home/recipes/', RecipesListView.as_view(), name= 'home/recipes'),
path('home/recipes/detail/', RecipesDetailView.as_view(), name = 'home/recipes/detail'),
path('home/recipes/update/', RecipesUpdateView.as_view(), name = 'home/recipes/update'),
path('home/recipes/create/', RecipesCreateView.as_view(), name = 'home/recipes/create'),
path('home/orders/', OrdersListView.as_view(), name = 'home/orders'),
path('home/orders/detail/', OrdersDetailView.as_view(), name = 'home/orders/detail'),
path('home/orders/update/', OrdersUpdateView.as_view(), name = 'home/orders/update'),
path('home/orders/create/', OrdersCreateView.as_view(), name = 'home/orders/create'),
]
\ No newline at end of file
from django.shortcuts import render
from django.views.generic.base import TemplateView
class HomePageView(TemplateView):
template_name = "home.html"
class IngredientsListView(TemplateView):
template_name = "ingredients_list.html"
class IngredientsDetailView(TemplateView):
template_name = "ingredients_detail.html"
class IngredientsUpdateView(TemplateView):
template_name = "ingredients_update_form.html"
class IngredientsCreateView(TemplateView):
template_name = "ingredients_create_form.html"
class RecipesListView(TemplateView):
template_name = "recipes_list.html"
class RecipesDetailView(TemplateView):
template_name = "recipes_detail.html"
class RecipesUpdateView(TemplateView):
template_name = "recipes_update_form.html"
class RecipesCreateView(TemplateView):
template_name = "recipes_create_form.html"
class OrdersListView(TemplateView):
template_name = "orders_list.html"
class OrdersDetailView(TemplateView):
template_name = "orders_detail.html"
class OrdersUpdateView(TemplateView):
template_name = "orders_update_form.html"
class OrdersCreateView(TemplateView):
template_name = "orders_create_form.html"
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
from selenium import webdriver from selenium import webdriver
import unittest import unittest
import time
class NewVisitorTest(unittest.TestCase): class NewVisitorTest(unittest.TestCase):
def setUp(self): def setUp(self):
...@@ -8,8 +9,180 @@ class NewVisitorTest(unittest.TestCase): ...@@ -8,8 +9,180 @@ class NewVisitorTest(unittest.TestCase):
def tearDown(self): def tearDown(self):
self.browser.quit() self.browser.quit()
def test_can_display_a_heroes_list_and_more_information_per_hero(self): def test_can_display_a_homepage_and_other_pages(self):
# self.browser.get('http://localhost:8000/heroes') # A customer has heard about a new frozen yogurt specialty shop called The Good Place FroYo Shop.
# He/She goes to check out its homepage
self.browser.get('http://localhost:8000/home')
# He/She notices the page title and header mention
# 'The Good Place FroYo Shop'
self.assertIn('The Good Place FroYo Shop Home Page', self.browser.title)
# He/She sees a list containing ingredients, recipes, and orders
Ingredients = self.browser.find_element_by_id('Ingredients')
Recipes = self.browser.find_element_by_id('Recipes')
Orders = self.browser.find_element_by_id('Orders')
# When he/she selects ingredients/recipes/orders on the list,
# he/she is sent to another page containing more information about
# ingredients/recipes/orders (detail, update, create)
Ingredients = self.browser.find_element_by_id('Ingredients')
Ingredients.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/home/ingredients/', self.browser.current_url)
self.assertIn('Ingredients - List', self.browser.title)
# Goes to ingredients detail
ingredientsDetail = self.browser.find_element_by_id('ingredientsDetail')
ingredientsDetail.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/home/ingredients/detail/', self.browser.current_url)
self.assertIn('Ingredients - Detail', self.browser.title)
# Goes back to ingredients list
ingredientsDetailToList = self.browser.find_element_by_id('ingredientsDetailToList')
self.assertEqual(ingredientsDetailToList.get_attribute('innerHTML'), 'Back to Ingredients List')
ingredientsDetailToList.click()
time.sleep(1)
# Goes to ingredients update
ingredientsUpdate = self.browser.find_element_by_id('ingredientsUpdate')
ingredientsUpdate.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/home/ingredients/update/', self.browser.current_url)
self.assertIn('Ingredients - Update', self.browser.title)
# Goes back to ingredients list
ingredientsUpdateToList = self.browser.find_element_by_id('ingredientsUpdateToList')
self.assertEqual(ingredientsUpdateToList.get_attribute('innerHTML'), 'Back to Ingredients List')
ingredientsUpdateToList.click()
time.sleep(1)
# Goes to ingredients create
ingredientsCreate = self.browser.find_element_by_id('ingredientsCreate')
ingredientsCreate.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/home/ingredients/create/', self.browser.current_url)
self.assertIn('Ingredients - Create', self.browser.title)
# Goes back to ingredients list
ingredientsCreateToList = self.browser.find_element_by_id('ingredientsCreateToList')
self.assertEqual(ingredientsCreateToList.get_attribute('innerHTML'), 'Back to Ingredients List')
ingredientsCreateToList.click()
time.sleep(1)
# Goes back to froyo home page
ingredientsListToHome = self.browser.find_element_by_id('ingredientsListToHome')
self.assertEqual(ingredientsListToHome.get_attribute('innerHTML'), 'Back to Froyo Home Page')
ingredientsListToHome.click()
time.sleep(1)
# Goes to recipes list
Recipes = self.browser.find_element_by_id('Recipes')
Recipes.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/home/recipes/', self.browser.current_url)
self.assertIn('Recipes - List', self.browser.title)
# Goes to recipes detail
recipesDetail = self.browser.find_element_by_id('recipesDetail')
recipesDetail.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/home/recipes/detail/', self.browser.current_url)
self.assertIn('Recipes - Detail', self.browser.title)
# Goes back to recipes list
recipesDetailToList = self.browser.find_element_by_id('recipesDetailToList')
self.assertEqual(recipesDetailToList.get_attribute('innerHTML'), 'Back to Recipes List')
recipesDetailToList.click()
time.sleep(1)
# Goes to recipes update
recipesUpdate = self.browser.find_element_by_id('recipesUpdate')
recipesUpdate.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/home/recipes/update/', self.browser.current_url)
self.assertIn('Recipes - Update', self.browser.title)
# Goes back to recipes list
recipesUpdateToList = self.browser.find_element_by_id('recipesUpdateToList')
self.assertEqual(recipesUpdateToList.get_attribute('innerHTML'), 'Back to Recipes List')
recipesUpdateToList.click()
time.sleep(1)
# Goes to recipes create
recipesCreate = self.browser.find_element_by_id('recipesCreate')
recipesCreate.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/home/recipes/create/', self.browser.current_url)
self.assertIn('Recipes - Create', self.browser.title)
# Goes back to recipes list
recipesCreateToList = self.browser.find_element_by_id('recipesCreateToList')
self.assertEqual(recipesCreateToList.get_attribute('innerHTML'), 'Back to Recipes List')
recipesCreateToList.click()
time.sleep(1)
# Goes back to froyo home page
recipesListToHome = self.browser.find_element_by_id('recipesListToHome')
self.assertEqual(recipesListToHome.get_attribute('innerHTML'), 'Back to Froyo Home Page')
recipesListToHome.click()
time.sleep(1)
# Goes to orders list
Orders = self.browser.find_element_by_id('Orders')
Orders.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/home/orders/', self.browser.current_url)
self.assertIn('Orders - List', self.browser.title)
# Goes to orders detail
ordersDetail = self.browser.find_element_by_id('ordersDetail')
ordersDetail.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/home/orders/detail/', self.browser.current_url)
self.assertIn('Orders - Detail', self.browser.title)
# Goes back to orders list
ordersDetailToList = self.browser.find_element_by_id('ordersDetailToList')
self.assertEqual(ordersDetailToList.get_attribute('innerHTML'), 'Back to Orders List')
ordersDetailToList.click()
time.sleep(1)
# Goes to orders update
ordersUpdate = self.browser.find_element_by_id('ordersUpdate')
ordersUpdate.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/home/orders/update/', self.browser.current_url)
self.assertIn('Orders - Update', self.browser.title)
# Goes back to orders list
ordersUpdateToList = self.browser.find_element_by_id('ordersUpdateToList')
self.assertEqual(ordersUpdateToList.get_attribute('innerHTML'), 'Back to Orders List')
ordersUpdateToList.click()
time.sleep(1)
# Goes to orders create
ordersCreate = self.browser.find_element_by_id('ordersCreate')
ordersCreate.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/home/orders/create/', self.browser.current_url)
self.assertIn('Orders - Create', self.browser.title)
# Goes back to orders list
ordersCreateToList = self.browser.find_element_by_id('ordersCreateToList')
self.assertEqual(ordersCreateToList.get_attribute('innerHTML'), 'Back to Orders List')
ordersCreateToList.click()
time.sleep(1)
# Goes back to froyo home page
ordersListToHome = self.browser.find_element_by_id('ordersListToHome')
self.assertEqual(ordersListToHome.get_attribute('innerHTML'), 'Back to Froyo Home Page')
ordersListToHome.click()
time.sleep(1)
self.fail('Finish the test!') self.fail('Finish the test!')
......
...@@ -20,7 +20,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) ...@@ -20,7 +20,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret! # SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'r-wmulbjgkf%e3!$&rsn8#hzu@53e8i1^b6s57g88^l=4plg@w' SECRET_KEY = '7l2)8&xn94kqgpt*_h_lgbo0lrrjib&%5@*r&hk5jo6*vrdq%('
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True DEBUG = True
...@@ -37,6 +37,8 @@ INSTALLED_APPS = [ ...@@ -37,6 +37,8 @@ INSTALLED_APPS = [
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'froyo'
] ]
MIDDLEWARE = [ MIDDLEWARE = [
...@@ -75,8 +77,12 @@ WSGI_APPLICATION = 'thegoodplace.wsgi.application' ...@@ -75,8 +77,12 @@ WSGI_APPLICATION = 'thegoodplace.wsgi.application'
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.sqlite3', 'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 'NAME': 'thegoodplace',
'USER': 'postgres',
'PASSWORD': 'apocalypto',
'HOST': 'localhost',
'PORT': '5432',
} }
} }
......
"""thegoodplace URL Configuration from django.conf.urls import include, url
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin from django.contrib import admin
from django.urls import path
urlpatterns = [ urlpatterns = [
path('admin/', admin.site.urls), url(r'^admin/', admin.site.urls),
] url(r'',include('froyo.urls')),
]
\ No newline at end of file
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