@@ -73,20 +73,16 @@ def test_desired_meetingdates_vocabulary(self, _rest_getMeetingsAcceptingItems,
73
73
def test_categories_for_user_vocabulary (self , _rest_getConfigInfos ):
74
74
"""Ensure that vocabularies values are the expected"""
75
75
76
- def set_config ():
77
- setCorrectSettingsConfig (self .portal , setConnectionParams = False , withValidation = False )
78
- ws4pmsettings = getMultiAdapter ((self .portal , self .portal .REQUEST ), name = "ws4pmclient-settings" )
79
- for i in range (len (ws4pmsettings .settings ().field_mappings )):
80
- if ws4pmsettings .settings ().field_mappings [i ]["field_name" ] == "category" :
81
- del ws4pmsettings .settings ().field_mappings [i ]
82
- break
83
- raw_voc = vocabularies .categories_for_user_vocabulary ()
84
- titles = [v .title for v in raw_voc (self .portal )]
85
- tokens = [v .token for v in raw_voc (self .portal )]
86
- return titles , tokens
87
-
76
+ # Set the correct settings
77
+ setCorrectSettingsConfig (self .portal , setConnectionParams = False , withValidation = False )
78
+ ws4pmsettings = getMultiAdapter ((self .portal , self .portal .REQUEST ), name = "ws4pmclient-settings" )
79
+ for i in range (len (ws4pmsettings .settings ().field_mappings )):
80
+ if ws4pmsettings .settings ().field_mappings [i ]["field_name" ] == "category" :
81
+ del ws4pmsettings .settings ().field_mappings [i ]
82
+ break
88
83
self .portal .REQUEST .set ("meetingConfigId" , u"plonegov-assembly" )
89
84
85
+ # First test with categories
90
86
_rest_getConfigInfos .return_value = [
91
87
{
92
88
"id" : u"plonegov-assembly" ,
@@ -99,18 +95,19 @@ def set_config():
99
95
},
100
96
{
101
97
"id" : "finances" ,
102
- "title" : "finances " ,
98
+ "title" : "Finances " ,
103
99
"enabled" : True ,
104
100
},
105
101
],
106
102
},
107
103
{"id" : u"plonemeeting-assembly" , "title" : u"PloneMeeting Assembly" },
108
104
]
109
- titles , tokens = set_config ()
110
- self .assertEqual (titles , [u"finances" , u"Urbanisme" ])
111
- self .assertEqual (tokens , [u"finances" , u"urbanisme" ])
105
+ voc = vocabularies .categories_for_user_vocabulary ()(self .portal )
106
+ self .assertListEqual (
107
+ [(v .token , v .title ) for v in voc ], [("finances" , u"Finances" ), ("urbanisme" , u"Urbanisme" )]
108
+ )
112
109
110
+ # Second test without categories
113
111
_rest_getConfigInfos .return_value = []
114
- titles , tokens = set_config ()
115
- self .assertEqual (titles , [])
116
- self .assertEqual (tokens , [])
112
+ voc = vocabularies .categories_for_user_vocabulary ()(self .portal )
113
+ self .assertListEqual (list (voc ), [])
0 commit comments