|
@@ -26,7 +26,6 @@ class HomePageTest(TestCase):
|
|
|
|
|
|
def test_can_save_POST_request(self):
|
|
|
response = self.client.post('/', data={'item_text': 'A new list item'})
|
|
|
-
|
|
|
self.assertEqual(Item.objects.count(), 1)
|
|
|
new_item = Item.objects.first()
|
|
|
self.assertEqual(new_item.text, 'A new list item')
|
|
@@ -43,8 +42,9 @@ class ListViewTest(TestCase):
|
|
|
self.assertTemplateUsed(response, 'list.html')
|
|
|
|
|
|
def test_displays_all_items(self):
|
|
|
- Item.objects.create(text='itemey 1')
|
|
|
- Item.objects.create(text='itemey 2')
|
|
|
+ list_ = List.objects.create()
|
|
|
+ Item.objects.create(text='itemey 1', listi=list_)
|
|
|
+ Item.objects.create(text='itemey 2', listi=list_)
|
|
|
|
|
|
response = self.client.get('/lists/the-only-list/')
|
|
|
|
|
@@ -58,12 +58,12 @@ class ListAndItemModelsTest(TestCase):
|
|
|
list_.save()
|
|
|
item1 = Item()
|
|
|
item1.text = 'The first (ever) list item'
|
|
|
- item1.list = list_
|
|
|
+ item1.listi = list_
|
|
|
item1.save()
|
|
|
|
|
|
item2 = Item()
|
|
|
item2.text = 'Item the 2nd'
|
|
|
- item2.list = list_
|
|
|
+ item2.listi = list_
|
|
|
item2.save()
|
|
|
|
|
|
savedL = List.objects.first()
|
|
@@ -75,9 +75,9 @@ class ListAndItemModelsTest(TestCase):
|
|
|
first_item = savedI[0]
|
|
|
second_item = savedI[1]
|
|
|
self.assertEqual(first_item.text, item1.text)
|
|
|
- self.assertEqual(first_item.list, list_)
|
|
|
+ self.assertEqual(first_item.listi, list_)
|
|
|
self.assertEqual(second_item.text, item2.text)
|
|
|
- self.assertEqual(second_item.list, list_)
|
|
|
+ self.assertEqual(second_item.listi, list_)
|
|
|
|
|
|
class NewListTest(TestCase):
|
|
|
|