def test_cannot_save_empty_list_items(self): list_ = List.objects.create() item = Item(list=list_, text='') with self.assertRaises(ValidationError): item.save() item.full_clean()
def test_item_is_related_to_list(self): list_ = List.objects.create() item = Item() item.list = list_ item.save() self.assertIn(item, list_.item_set.all())