defined Meta ordering of the Item() model in apps.dashboard.models; Item() also now returns a __str__ result; in .forms, defined a specific use-case of is_valid() method; a pair of new UTs in .tests.test_models help confirm str representation and list order of items; .test_forms now ensures the .is-invalid bootstrap class is tested as a css class attr; migrations run; full UT & FT suite back to passing state (tho a refactor of flimsy form customizations is desperately needed)
This commit is contained in:
@@ -23,6 +23,15 @@ class ItemFormTest(TestCase):
|
||||
self.assertFalse(form.is_valid())
|
||||
self.assertEqual(form.errors["text"], [EMPTY_ITEM_ERROR])
|
||||
|
||||
def test_invalid_form_has_bootstrap_is_invalid_css_class(self):
|
||||
form = ItemForm(data={"text": ""})
|
||||
self.assertFalse(form.is_valid())
|
||||
field = form.fields["text"]
|
||||
self.assertEqual(
|
||||
field.widget.attrs["class"],
|
||||
"form-control form-control-lg is-invalid",
|
||||
)
|
||||
|
||||
def test_form_save_handles_saving_to_a_list(self):
|
||||
mylist = List.objects.create()
|
||||
form = ItemForm(data={"text": "do re mi"})
|
||||
|
||||
Reference in New Issue
Block a user