Fakultas Ilmu Komputer UI

Commit 15da4468 authored by Dwi Nanda Susanto's avatar Dwi Nanda Susanto
Browse files

pass the custom comment test

parent df46967f
......@@ -15,7 +15,7 @@ class HomePageTest(TestCase):
response = self.client.get('/')
html = response.content.decode('utf8')
self.assertTrue(html.startswith('<html>'))
self.assertIn('<title>To-Do lists</title>', html)
self.assertIn('<title>To-Do</title>', html)
self.assertTrue(html.strip().endswith('</html>'))
self.assertTemplateUsed(response, 'home.html')
......@@ -48,6 +48,24 @@ class HomePageTest(TestCase):
self.assertIn('itemey 1', response.content.decode())
self.assertIn('itemey 2', response.content.decode())
def test_comment_on_zero_items(self):
response = self.client.get('/')
self.assertIn('yey, waktunya berlibur', response.content.decode())
def test_comment_on_few_items(self):
for i in range(2):
Item.objects.create(text='itemey %d' % i)
response = self.client.get('/')
self.assertIn('sibuk tapi santai', response.content.decode())
def test_comment_on_many_items(self):
for i in range(6):
Item.objects.create(text='itemey %d' % i)
response = self.client.get('/')
self.assertIn('oh tidak', response.content.decode())
class ItemModelTest(TestCase):
def test_saving_and_retrieving_items(self):
first_item = Item()
......
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