Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
thalia
concrexit
Commits
25139a3b
Unverified
Commit
25139a3b
authored
Feb 16, 2018
by
Thom Wiggers
📐
Browse files
Add ordering test
parent
c9a53c76
Changes
1
Hide whitespace changes
Inline
Side-by-side
website/events/tests/test_services.py
View file @
25139a3b
...
...
@@ -364,6 +364,8 @@ class ServicesTest(TestCase):
RegistrationInformationField
.
objects
.
create
(
id
=
1
,
name_en
=
'1'
,
name_nl
=
'1'
,
type
=
RegistrationInformationField
.
INTEGER_FIELD
,
event
=
self
.
event
,
required
=
False
,
...
...
@@ -371,6 +373,8 @@ class ServicesTest(TestCase):
RegistrationInformationField
.
objects
.
create
(
id
=
2
,
name_en
=
'2'
,
name_nl
=
'2'
,
type
=
RegistrationInformationField
.
BOOLEAN_FIELD
,
event
=
self
.
event
,
required
=
True
,
...
...
@@ -378,16 +382,20 @@ class ServicesTest(TestCase):
RegistrationInformationField
.
objects
.
create
(
id
=
3
,
name_nl
=
'3'
,
name_en
=
'3'
,
type
=
RegistrationInformationField
.
TEXT_FIELD
,
event
=
self
.
event
,
required
=
False
,
)
# set order
self
.
event
.
set_registrationinformationfield_order
([
1
,
2
,
3
])
fields
=
services
.
registration_fields
(
self
.
member
,
self
.
event
)
self
.
assertEqual
(
fields
[
'info_field_1'
],
{
'type'
:
'integer'
,
'label'
:
''
,
'label'
:
'
1
'
,
'description'
:
None
,
'value'
:
None
,
'required'
:
False
...
...
@@ -395,7 +403,7 @@ class ServicesTest(TestCase):
self
.
assertEqual
(
fields
[
'info_field_2'
],
{
'type'
:
'boolean'
,
'label'
:
''
,
'label'
:
'
2
'
,
'description'
:
None
,
'value'
:
None
,
'required'
:
True
...
...
@@ -403,10 +411,13 @@ class ServicesTest(TestCase):
self
.
assertEqual
(
fields
[
'info_field_3'
],
{
'type'
:
'text'
,
'label'
:
''
,
'label'
:
'
3
'
,
'description'
:
None
,
'value'
:
None
,
'required'
:
False
})
self
.
assertEqual
(
len
(
fields
),
3
)
# Test that the ordering is correct
labels
=
[
field
[
'label'
]
for
field
in
fields
.
values
()]
self
.
assertEqual
(
labels
,
sorted
(
labels
))
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment