Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
Francia - 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
Alex Bernard Francia
Francia - Midterm Project
Commits
0a7d0800
Commit
0a7d0800
authored
Mar 19, 2020
by
Alex Bernard Francia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored home page unit test. Succesful.
parent
99839ae3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
5 deletions
+21
-5
tests.py
froyo/tests.py
+21
-5
No files found.
froyo/tests.py
View file @
0a7d0800
from
django.urls
import
resolve
#
from django.urls import resolve
from
django.test
import
TestCase
from
django.test
import
TestCase
from
.views
import
go_to_home_page
# from django.template.loader import render_to_string
# from .views import go_to_home_page
# Create your tests here.
# Create your tests here.
class
HomePageTest
(
TestCase
):
class
HomePageTest
(
TestCase
):
def
test_root_url_resolves_to_home_page_view
(
self
):
found
=
resolve
(
'/'
)
self
.
assertEqual
(
found
.
func
,
go_to_home_page
)
def
test_home_page_returns_correct_html
(
self
):
\ No newline at end of file
response
=
self
.
client
.
get
(
'/'
)
# html = response.content.decode('utf8')
# expected_html = render_to_string('home_page.html')
# self.assertTrue(html.startswith('<html>'))
# self.assertIn('<title>The Good Place</title>',html)
# self.assertTrue(html.endswith('</html>'))
# self.assertEqual(html, expected_html)
self
.
assertTemplateUsed
(
response
,
'home_page.html'
)
\ 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