Remove bottle-formula validation test

This is not really necessary and only serves as validation that will need to updated if model choices ever change.
This commit is contained in:
Christopher C. Wells 2020-02-17 14:20:38 -08:00 committed by Christopher Charbonneau Wells
parent 959649f5f7
commit 2346995cb3
2 changed files with 1 additions and 15 deletions

View File

@ -252,13 +252,6 @@ class Feeding(models.Model):
validate_duration(self) validate_duration(self)
validate_unique_period(Feeding.objects.filter(child=self.child), self) validate_unique_period(Feeding.objects.filter(child=self.child), self)
# "Formula" Type may only be associated with "Bottle" Method.
if self.type == 'formula' and self.method != 'bottle':
raise ValidationError(
{'method':
_('Only "Bottle" method is allowed with "Formula" type.')},
code='bottle_formula_mismatch')
class Note(models.Model): class Note(models.Model):
model_name = 'note' model_name = 'note'

View File

@ -263,16 +263,9 @@ class FeedingFormsTestCase(FormsTestCaseBase):
'start': self.localtime_string(start), 'start': self.localtime_string(start),
'end': self.localtime_string(end), 'end': self.localtime_string(end),
'type': 'formula', 'type': 'formula',
'method': 'left breast', 'method': 'bottle',
'amount': 0 'amount': 0
} }
page = self.c.post('/feedings/add/', params)
self.assertEqual(page.status_code, 200)
self.assertFormError(
page, 'form', 'method',
'Only "Bottle" method is allowed with "Formula" type.')
params.update({'method': 'bottle'})
page = self.c.post('/feedings/add/', params, follow=True) page = self.c.post('/feedings/add/', params, follow=True)
self.assertEqual(page.status_code, 200) self.assertEqual(page.status_code, 200)
self.assertContains( self.assertContains(