Verified Commit 81a621cc authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Test for right error messages from Registration model

parent ab10c4ca
...@@ -23,7 +23,8 @@ class MemberRegistrationForm(forms.ModelForm): ...@@ -23,7 +23,8 @@ class MemberRegistrationForm(forms.ModelForm):
class Meta: class Meta:
model = Registration model = Registration
fields = '__all__' fields = '__all__'
exclude = ['created_at', 'updated_at', 'status', 'username', 'remarks'] exclude = ['created_at', 'updated_at', 'status', 'username', 'remarks',
'payment', 'membership']
class MemberRenewalForm(forms.ModelForm): class MemberRenewalForm(forms.ModelForm):
......
...@@ -129,14 +129,20 @@ class RegistrationTest(TestCase): ...@@ -129,14 +129,20 @@ class RegistrationTest(TestCase):
def test_require_programme_members(self): def test_require_programme_members(self):
self.registration.programme = None self.registration.programme = None
with self.assertRaises(ValidationError): with self.assertRaisesMessage(
ValidationError,
"{'programme': ['Dit veld is vereist.']}"
):
self.registration.clean() self.registration.clean()
self.registration.membership_type = Membership.SUPPORTER self.registration.membership_type = Membership.SUPPORTER
self.registration.clean() self.registration.clean()
def test_require_starting_year_members(self): def test_require_starting_year_members(self):
self.registration.starting_year = None self.registration.starting_year = None
with self.assertRaises(ValidationError): with self.assertRaisesMessage(
ValidationError,
"{'starting_year': ['Dit veld is vereist.']}"
):
self.registration.clean() self.registration.clean()
self.registration.membership_type = Membership.SUPPORTER self.registration.membership_type = Membership.SUPPORTER
self.registration.clean() self.registration.clean()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment