@@ -282,6 +282,46 @@ def test_invalidJSONDataAndPath(self):
282
282
errors
283
283
)
284
284
285
+ @patch ('os.path.basename' , return_value = "invalid addon id" )
286
+ def test_invalidAddonIdFormat_spaces (self , mock_basename ):
287
+ """ Error when submission does not include correct addonId format
288
+ """
289
+ self .submissionData ['addonId' ] = "invalid addon id"
290
+ self .manifest ['name' ] = "invalid addon id"
291
+ errors = list (
292
+ validate .checkAddonId (self .manifest , VALID_SUBMISSION_JSON_FILE , self .submissionData )
293
+ )
294
+
295
+ self .assertEqual (
296
+ [ # expected errors
297
+ "Submission data 'addonId' field does not match the expected format:"
298
+ " must start and end with a letter, and contain only letters,"
299
+ " numbers, and hyphens. "
300
+ "ID: invalid addon id"
301
+ ],
302
+ errors
303
+ )
304
+
305
+ @patch ('os.path.basename' , return_value = "1invalid-addon-id" )
306
+ def test_invalidAddonIdFormat_invalidStartChar (self , mock_basename ):
307
+ """ Error when submission does not include correct addonId format
308
+ """
309
+ self .submissionData ['addonId' ] = "1invalid-addon-id"
310
+ self .manifest ['name' ] = "1invalid-addon-id"
311
+ errors = list (
312
+ validate .checkAddonId (self .manifest , VALID_SUBMISSION_JSON_FILE , self .submissionData )
313
+ )
314
+
315
+ self .assertEqual (
316
+ [ # expected errors
317
+ "Submission data 'addonId' field does not match the expected format:"
318
+ " must start and end with a letter, and contain only letters,"
319
+ " numbers, and hyphens. "
320
+ "ID: 1invalid-addon-id"
321
+ ],
322
+ errors
323
+ )
324
+
285
325
286
326
@dataclass
287
327
class VersionNumber :
0 commit comments