def test_valid_data(self): task = ModelFactory.make('Task') blank_form = TaskForm() index = int(len(blank_form.fields['cogat_id'].choices) * random.random()) form = TaskForm({ 'cogat_id': blank_form.fields['cogat_id']._get_choices()[index][0], 'number': task.number }) self.assertTrue(form.is_valid())
def test_valid_data(self): task = ModelFactory.make('Task') blank_form = TaskForm() index = int( len(blank_form.fields['cogat_id'].choices) * random.random()) form = TaskForm({ 'cogat_id': blank_form.fields['cogat_id']._get_choices()[index][0], 'number': task.number }) self.assertTrue(form.is_valid())
def test_blank_data(self): form = TaskForm({}) self.assertFalse(form.is_valid())