Fakultas Ilmu Komputer UI

Commit 4840b6c6 authored by Agas Yanpratama's avatar Agas Yanpratama 💬
Browse files

Add Unit test on models to delete list item

parent c249473f
Pipeline #28405 failed with stages
in 5 minutes and 37 seconds
......@@ -36,3 +36,23 @@ class ListAndItemModelsTest(TestCase):
self.assertEqual(second_saved_item.text, 'Item the second')
self.assertEqual(second_saved_item.list, list_)
def test_saving_and_deleting_items(self):
list_ = List()
first_item = Item()
first_item.text = 'The first (ever) list item'
first_item.list = list_
saved_items = Item.objects.all()
self.assertEqual(saved_items.count(), 1)
saved_list = List.objects.first()
saved_obj = saved_items[0]
deleteItem(self, saved_list.id, saved_items.id)
saved_items_after_del = Item.objects.all()
self.assertEqual(saved_items_after_del.count(), 0)
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