def test_last_alternative(self): form = HealthForm(self.usertest) self.assertEqual(form.last_alternative().type_activity, 'So') self.assertEqual(form.last_alternative('Su').substitut, 'P24') self.assertEqual(form.last_alternative('Ac', 'Sp').activity, 'COURSE') self.assertEqual(form.last_alternative('Ac', 'So').activity, 'MASSAGE') self.assertEqual(form.last_alternative('Ac', 'Lo'), None)
def test_choices_first_health(self): ConsoAlternative.objects.all().delete() self.assertEqual(ConsoAlternative.objects.count(), 0) form = HealthForm(self.usertest) self.assertEqual(form.last_alternative().type_alternative, 'Su') self.assertEqual(form.last_alternative('Su').substitut, 'PAST') self.assertEqual(form.last_alternative('Ac', 'Sp').activity, 'COURSE') self.assertEqual(form.last_alternative('Ac', 'So').activity, 'MASSAGE') self.assertEqual(form.last_alternative('Ac', 'Lo'), None) self.assertEqual(form.initial['type_alternative_field'][0], 'Su') self.assertEqual(form.initial['sp_field'][0], self.db_alternative_activity_sp.id) self.assertEqual(form.initial['so_field'][0], self.db_alternative_activity_so2.id) self.assertEqual(form.initial['su_field'][0], self.db_alternative_substitut_past.id)