@@ -163,10 +163,6 @@ def test_finding_patch_remove_tags_all(self):
163
163
def test_finding_patch_remove_tags_non_existent (self ):
164
164
return self .test_finding_put_remove_tags_non_existent ()
165
165
166
- def test_finding_create_tags_with_commas (self ):
167
- tags = ["one,two" ]
168
- self .create_finding_with_tags (tags , expected_status_code = 400 )
169
-
170
166
def test_finding_create_tags_with_spaces (self ):
171
167
tags = ["one two" ]
172
168
self .create_finding_with_tags (tags , expected_status_code = 400 )
@@ -212,6 +208,25 @@ def test_import_and_reimport_with_tags(self):
212
208
for tag in tags :
213
209
self .assertIn (tag , response ["tags" ])
214
210
211
+ def test_import_multipart_tags (self ):
212
+ with (self .zap_sample5_filename ).open (encoding = "utf-8" ) as testfile :
213
+ data = {
214
+ "engagement" : [1 ],
215
+ "file" : [testfile ],
216
+ "scan_type" : ["ZAP Scan" ],
217
+ "tags" : ["bug,security" , "urgent" ], # Attempting to mimic the two "tag" fields (-F 'tags=tag1' -F 'tags=tag2')
218
+ }
219
+ response = self .import_scan (data , 201 )
220
+ # Make sure the serializer returns the correct tags
221
+ success_tags = ["bug" , "security" , "urgent" ]
222
+ self .assertEqual (response ["tags" ], success_tags )
223
+ # Check that the test has the same issue
224
+ test_id = response ["test" ]
225
+ response = self .get_test_api (test_id )
226
+ self .assertEqual (len (success_tags ), len (response .get ("tags" )))
227
+ for tag in success_tags :
228
+ self .assertIn (tag , response ["tags" ])
229
+
215
230
216
231
class InheritedTagsTests (DojoAPITestCase ):
217
232
fixtures = ["dojo_testdata.json" ]
0 commit comments