Commit 431525a8 authored by abbeeeeyyyyy's avatar abbeeeeyyyyy

Merging the updated files with the outdated files

parents 6d6ab481 719f35b2
<!DOCTYPE html>
<html>
<head>
<title>Detail - Cloud</title>
</head>
<body>
<img src="./cloud.png" style="width: 10vw;" />
<h1>Detail - Cloud</h1>
<dl>
<dt>Health Points</dt><dd>600</dd>
<dt>Base Attack Damage</dt><dd>57</dd>
<dt>Skills</dt><dd>Nimbus, Rain Cloud, Thunderbolt</dd>
<dt>Lore</dt><dd>I am a cloud. When I pee you call it 'rain'.</dd>
</dl>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<title>Detail - Jester</title>
</head>
<body>
<img src="./jester.png" style="width: 10vw;"/>
<h1>Detail - Jester</h1>
<dl>
<dt>Health Points</dt><dd>660</dd>
<dt>Base Attack Damage</dt><dd>64</dd>
<dt>Skills</dt><dd>Laugh, Dance, Smile</dd>
<dt>Lore</dt><dd>I do it for the LOLs.</dd>
</dl>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<title>Detail - Sunflowey</title>
</head>
<body>
<img src="./sunflowey.png" style="width: 10vw;" />
<h1>Detail - Sunflowey</h1>
<dl>
<dt>Health Points</dt><dd>650</dd>
<dt>Base Attack Damage</dt><dd>43</dd>
<dt>Skills</dt><dd>Power Pellet, Sunshine, Pollen Punch</dd>
<dt>Lore</dt><dd>I am Sunflowey. Sometimes a sun, sometimes a flower.</dd>
</dl>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
from django.contrib import admin
# Register your models here.
from django.apps import AppConfig
class HeroesConfig(AppConfig):
name = 'heroes'
from django.db import models
# Create your models here.
{% load static %}
<!DOCTYPE html>
<html>
<head>
<title>Detail - Cloud</title>
</head>
<body>
<img src="{% static "heroes/images/cloud.png" %}" style="width: 10vw;" />
<h1>Detail - Cloud</h1>
<dl>
<dt>Health Points</dt>
<dd>600</dd>
<dt>Base Attack Damage</dt>
<dd>57</dd>
<dt>Skills</dt>
<dd>Nimbus, Rain Cloud, Thunderbolt</dd>
<dt>Lore</dt>
<dd>I am a cloud. When I pee you call it 'rain'.</dd>
</dl>
<button> <a href="{% url "heroes" %}"> Back to Heroes List </a> </button>
</body>
</html>
\ No newline at end of file
{% load static %}
<!DOCTYPE html>
<html>
<head>
<title>Detail - Jester</title>
</head>
<body>
<img src="{% static "heroes/images/jester.png" %}" style="width: 10vw;" />
<h1>Detail - Jester</h1>
<dl>
<dt>Health Points</dt>
<dd>660</dd>
<dt>Base Attack Damage</dt>
<dd>64</dd>
<dt>Skills</dt>
<dd>Laugh, Dance, Smile</dd>
<dt>Lore</dt>
<dd>I do it for the LOLs.</dd>
</dl>
<button> <a href="{% url "heroes" %}"> Back to Heroes List </a></button>
</body>
</html>
\ No newline at end of file
{% load static %}
<!DOCTYPE html>
<html>
<head>
<title>Detail - Sunflowey</title>
</head>
<body>
<img src="{% static "heroes/images/sunflowey.png" %}" style="width: 10vw;" />
<h1>Detail - Sunflowey</h1>
<dl>
<dt>Health Points</dt>
<dd>650</dd>
<dt>Base Attack Damage</dt>
<dd>43</dd>
<dt>Skills</dt>
<dd>Power Pellet, Sunshine, Pollen Punch</dd>
<dt>Lore</dt>
<dd>I am Sunflowey. Sometimes a sun, sometimes a flower.</dd>
</dl>
<button> <a href="{% url "heroes" %}">Back to Heroes List </a> </button>
</body>
</html>
\ No newline at end of file
{% load static %}
<html> <html>
<head> <head>
<title> Will-O-Wisp </title> <title> The Will of the Wisps Wiki </title>
</head> </head>
<body> <body>
<h1> Will-O-Wisp Heroes </h1> <h1> Will-O-Wisp Heroes </h1>
<h1>Jester</h1> <h1 id="jester"> <a href="{% url "jester" %}" > Jester </a> </h1>
<dl> <dl>
<dt>Health Points</dt> <dt>Health Points</dt>
<dd>660</dd> <dd id="hp-jester">660</dd>
<dt>Base Attack Damage</dt> <dt>Base Attack Damage</dt>
<dd>64</dd> <dd id="d-jester">64</dd>
</dl> </dl>
<button onclick="window.location.href = 'detail_jester.html';">More Information</button> <h1 id="cloud"> <a href="{% url "cloud" %}"> Cloud </a> </h1>
<h1>Cloud</h1>
<dl> <dl>
<dt>Health Points</dt> <dt>Health Points</dt>
<dd>600</dd> <dd id="hp-cloud">600</dd>
<dt>Base Attack Damage</dt> <dt>Base Attack Damage</dt>
<dd>57</dd> <dd id="d-cloud">57</dd>
</dl> </dl>
<button onclick="window.location.href = 'detail_cloud.html';">More Information</button> <h1 id="sunflowey"><a href="{% url "sunflowey" %}"> Sunflowey </a> </h1>
<h1>Sunflowey</h1>
<dl> <dl>
<dt>Health Points</dt> <dt>Health Points</dt>
<dd>650</dd> <dd id="hp-sunflowey">650</dd>
<dt>Base Attack Damage</dt> <dt>Base Attack Damage</dt>
<dd>43</dd> <dd id="d-sunflowey">43</dd>
</dl> </dl>
<button onclick="window.location.href = 'detail_sunflowey.html';">More Information</button>
</body> </body>
</html> </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 HeroesView
from .views import JesterView
from .views import CloudView
from .views import SunfloweyView
from django.template.loader import render_to_string
# Create your tests here.
class HeroesSiteTest(TestCase):
def test_home_page_returns_correct_html(self):
response = self.client.get('/heroes/')
self.assertTemplateUsed(response, 'heroes.html')
def test_jester_page_returns_correct_html(self):
response = self.client.get('/hero/jester/')
self.assertTemplateUsed(response,'detail_jester.html')
def test_cloud_page_returns_correct_html(self):
response = self.client.get('/hero/cloud/')
self.assertTemplateUsed(response, 'detail_cloud.html')
def test_sunflowey_page_returns_correct_html(self):
response = self.client.get('/hero/sunflowey/')
self.assertTemplateUsed(response, 'detail_sunflowey.html')
from django.urls import path
from django.contrib import admin
from .views import HeroesView
from .views import JesterView
from .views import SunfloweyView
from .views import CloudView
urlpatterns = [
path('', HeroesView.as_view(), name='heroes'),
path('heroes/', HeroesView.as_view(), name='heroes'),
path('hero/jester/', JesterView.as_view(), name='jester'),
path('hero/sunflowey/', SunfloweyView.as_view(), name='sunflowey'),
path('hero/cloud/', CloudView.as_view(), name='cloud'),
]
\ No newline at end of file
from django.views.generic.base import TemplateView
from . import templates
from django.shortcuts import render
# Create your views here.
# Create your views here.
class HeroesView(TemplateView):
template_name = 'heroes.html'
class JesterView(TemplateView):
template_name = 'detail_jester.html'
class CloudView(TemplateView):
template_name = 'detail_cloud.html'
class SunfloweyView(TemplateView):
template_name = 'detail_sunflowey.html'
...@@ -11,7 +11,7 @@ class NewVisitorTest(unittest.TestCase): ...@@ -11,7 +11,7 @@ class NewVisitorTest(unittest.TestCase):
def test_can_display_a_heroes_list_and_more_information_per_hero(self): def test_can_display_a_heroes_list_and_more_information_per_hero(self):
# Widget has heard about a new wiki app for the game called The Will of the Wisps. # Widget has heard about a new wiki app for the game called The Will of the Wisps.
# She goes to check out its homepage # She goes to check out its homepage
browser.get('http://localhost:8000') self.browser.get('http://localhost:8000')
# She notices the page title and header mention # She notices the page title and header mention
# 'The Will of the Wisps Wiki' # 'The Will of the Wisps Wiki'
...@@ -19,14 +19,66 @@ class NewVisitorTest(unittest.TestCase): ...@@ -19,14 +19,66 @@ 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.assertIn('Cloud',)
self.assertIn('Jester', self.browser.find_element_by_id('jester').text)
self.assertIn('660', self.browser.find_element_by_id('hp-jester').text)
self.assertIn('64', self.browser.find_element_by_id('d-jester').text)
self.assertIn('Cloud', self.browser.find_element_by_id('cloud').text)
self.assertIn('600', self.browser.find_element_by_id('hp-cloud').text)
self.assertIn('57', self.browser.find_element_by_id('d-cloud').text)
self.assertIn('Sunflowey', self.browser.find_element_by_id('sunflowey').text)
self.assertIn('650', self.browser.find_element_by_id('hp-sunflowey').text)
self.assertIn('43', self.browser.find_element_by_id('d-sunflowey').text)
# When she selects one of the heroes, she is sent to another page
# containing more information about the hero (additional stats, lore, image).
link = self.browser.find_element_by_link_text('Jester')
link.click()
# She spots the page title and header mentions the name of the hero she selected.
self.assertIn('Detail - Jester', self.browser.title)
self.assertIn('Detail - Jester', self.browser.find_element_by_tag_name('h1').text)
# 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.
homePageLink = self.browser.find_element_by_link_text('Back to Heroes List')
homePageLink.click()
# 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).
link = self.browser.find_element_by_link_text('Cloud')
link.click()
# 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('Detail - Cloud', self.browser.title)
self.assertIn('Detail - Cloud', self.browser.find_element_by_tag_name('h1').text)
# 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.
homePageLink = self.browser.find_element_by_link_text('Back to Heroes List')
homePageLink.click()
# When she selects one of the heroes, she is sent to another page
# containing more information about the hero (additional stats, lore, image).
link = self.browser.find_element_by_link_text('Sunflowey')
link.click()
# She spots the page title and header mentions the name of the hero she selected.
self.assertIn('Detail - Sunflowey', self.browser.title)
self.assertIn('Detail - Sunflowey', self.browser.find_element_by_tag_name('h1').text)
# 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.
homePageLink = self.browser.find_element_by_link_text('Back to Heroes List')
homePageLink.click()
self.fail('Finish the test!')
self.fail('Finish the test!')
\ No newline at end of file
if __name__ == '__main__':
unittest.main(warnings='ignore')
\ No newline at end of file
...@@ -37,6 +37,7 @@ INSTALLED_APPS = [ ...@@ -37,6 +37,7 @@ INSTALLED_APPS = [
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'heroes',
] ]
MIDDLEWARE = [ MIDDLEWARE = [
...@@ -54,7 +55,9 @@ ROOT_URLCONF = 'willowisp.urls' ...@@ -54,7 +55,9 @@ ROOT_URLCONF = 'willowisp.urls'
TEMPLATES = [ TEMPLATES = [
{ {
'BACKEND': 'django.template.backends.django.DjangoTemplates', 'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [], 'DIRS': [
'templates'
],
'APP_DIRS': True, 'APP_DIRS': True,
'OPTIONS': { 'OPTIONS': {
'context_processors': [ 'context_processors': [
...@@ -118,3 +121,7 @@ USE_TZ = True ...@@ -118,3 +121,7 @@ USE_TZ = True
# https://docs.djangoproject.com/en/3.0/howto/static-files/ # https://docs.djangoproject.com/en/3.0/howto/static-files/
STATIC_URL = '/static/' STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'heroes/static')
]
...@@ -14,8 +14,9 @@ Including another URLconf ...@@ -14,8 +14,9 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 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 from django.urls import path, include
urlpatterns = [ urlpatterns = [
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
] path('', include('heroes.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