Fakultas Ilmu Komputer UI

Commit 95744644 authored by Rayza Arasj Mahardhika's avatar Rayza Arasj Mahardhika
Browse files

fix wrong test in unit test

parent ff2246dc
from django.urls import resolve
from django.urls import resolve, reverse
from django.test import TestCase
from django.http import HttpRequest
......@@ -19,16 +19,18 @@ class HomePageTest(TestCase):
self.assertIn('<h1>Welcome to Rayza\'s Homepage</h1>', html)
class AboutPageTest(TestCase):
def test_about_url_resolves_to_about_page_view(self):
found = resolve('/about')
found = resolve(reverse('about'))
self.assertEqual(found.func, about_page)
def test_about_page_returns_correct_html(self):
request = HttpRequest()
response = home_page(request)
response = about_page(request)
html = response.content.decode('utf8')
self.assertIn('<title>Rayza\'s About Page</title>', html)
self.assertIn('<h1>Hello my name is Rayza Arasj Mahardhika</h1>', html)
self.asserIn('<p>I\'m 21 years old</p>')
self.assertIn('<h1>Hello, my name is Rayza Arasj Mahardhika</h1>', html)
self.assertIn('<p>I\'m 21 years old</p>', html)
Supports Markdown
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