Unverified Commit 25139a3b authored by Thom Wiggers's avatar Thom Wiggers 📐
Browse files

Add ordering test

parent c9a53c76
...@@ -364,6 +364,8 @@ class ServicesTest(TestCase): ...@@ -364,6 +364,8 @@ class ServicesTest(TestCase):
RegistrationInformationField.objects.create( RegistrationInformationField.objects.create(
id=1, id=1,
name_en='1',
name_nl='1',
type=RegistrationInformationField.INTEGER_FIELD, type=RegistrationInformationField.INTEGER_FIELD,
event=self.event, event=self.event,
required=False, required=False,
...@@ -371,6 +373,8 @@ class ServicesTest(TestCase): ...@@ -371,6 +373,8 @@ class ServicesTest(TestCase):
RegistrationInformationField.objects.create( RegistrationInformationField.objects.create(
id=2, id=2,
name_en='2',
name_nl='2',
type=RegistrationInformationField.BOOLEAN_FIELD, type=RegistrationInformationField.BOOLEAN_FIELD,
event=self.event, event=self.event,
required=True, required=True,
...@@ -378,16 +382,20 @@ class ServicesTest(TestCase): ...@@ -378,16 +382,20 @@ class ServicesTest(TestCase):
RegistrationInformationField.objects.create( RegistrationInformationField.objects.create(
id=3, id=3,
name_nl='3',
name_en='3',
type=RegistrationInformationField.TEXT_FIELD, type=RegistrationInformationField.TEXT_FIELD,
event=self.event, event=self.event,
required=False, required=False,
) )
# set order
self.event.set_registrationinformationfield_order([1, 2, 3])
fields = services.registration_fields(self.member, self.event) fields = services.registration_fields(self.member, self.event)
self.assertEqual(fields['info_field_1'], { self.assertEqual(fields['info_field_1'], {
'type': 'integer', 'type': 'integer',
'label': '', 'label': '1',
'description': None, 'description': None,
'value': None, 'value': None,
'required': False 'required': False
...@@ -395,7 +403,7 @@ class ServicesTest(TestCase): ...@@ -395,7 +403,7 @@ class ServicesTest(TestCase):
self.assertEqual(fields['info_field_2'], { self.assertEqual(fields['info_field_2'], {
'type': 'boolean', 'type': 'boolean',
'label': '', 'label': '2',
'description': None, 'description': None,
'value': None, 'value': None,
'required': True 'required': True
...@@ -403,10 +411,13 @@ class ServicesTest(TestCase): ...@@ -403,10 +411,13 @@ class ServicesTest(TestCase):
self.assertEqual(fields['info_field_3'], { self.assertEqual(fields['info_field_3'], {
'type': 'text', 'type': 'text',
'label': '', 'label': '3',
'description': None, 'description': None,
'value': None, 'value': None,
'required': False 'required': False
}) })
self.assertEqual(len(fields), 3) self.assertEqual(len(fields), 3)
# Test that the ordering is correct
labels = [field['label'] for field in fields.values()]
self.assertEqual(labels, sorted(labels))
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