@@ -154,3 +154,35 @@ def test_nodes():
154154
155155 with self .assertRaisesRegex (Exception , "Test error!" ):
156156 self .manager .publish (test_nodes ())
157+
158+ def test_collection_args (self ):
159+ """
160+ Ensures the collection_args propagation to the collector hook
161+ """
162+ collection_args = {
163+ "flag_1" : True ,
164+ "flag_2" : False ,
165+ "flag_3" : 10 ,
166+ }
167+ # if collection_args is provided to collect_session
168+ # api_collector adds collection_args to root item properties
169+ # this is done only for test purposes
170+
171+ # without collection_args provided,
172+ # root_item properties do not contain collection_args
173+ self .manager .collect_session ()
174+ root_item = self .manager .tree .root_item
175+ root_item_properties = root_item .properties
176+ self .assertEqual ('flag_1' not in root_item_properties , True )
177+ self .assertEqual ('flag_2' not in root_item_properties , True )
178+ self .assertEqual ('flag_3' not in root_item_properties , True )
179+
180+ # now we provide collection_args
181+ self .manager .collect_session (collection_args )
182+
183+ # so properties should be filled
184+ self .assertEqual (root_item .properties ["flag_1" ], collection_args ["flag_1" ])
185+ self .assertEqual (root_item .properties ["flag_2" ], collection_args ["flag_2" ])
186+ self .assertEqual (root_item .properties ["flag_3" ], collection_args ["flag_3" ])
187+
188+
0 commit comments