def assert_form_errors(response, *errors): """Given a response, assert that only the given `errors` are present in the form response.""" efe = expected_form_errors = set(errors) assert set(form_errors(response).keys()) - efe == set()
def test_add_project_no_name(self): response = self.post('base:add_project', {'description': 'cats cats cats'}) assert 'This field is required.' in form_errors(response)['name']