def test_callback_form_with_no_name_and_phone(self): form = CallbackForm({}) self.assertFalse(form.is_valid()) self.assertEqual( form.errors, { 'name': ['Это поле обязательно.'], 'phone': ['Это поле обязательно.'], })
def test_callback_form_with_name_and_phone(self): form = CallbackForm({ 'name': "Leela", 'phone': "+380123456789", }) self.assertTrue(form.is_valid())
def test_cart_form_with_normal_quantity(self): form = CallbackForm({ 'quantity': "1", }) self.assertFalse(form.is_valid())
def test_cart_form_with_excess_of_quantity(self): form = CallbackForm({ 'quantity': "21", }) self.assertFalse(form.is_valid())