Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions _tests/test_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,22 @@ def test_valid(self):
errors
)

@patch('os.path.basename', return_value="valid1-Addon_id")
def test_valid_withSymbols(self, mock_basename):
""" Error when submission does not include correct addonId format
"""
self.submissionData['addonId'] = "valid1-Addon_id"
self.manifest['name'] = "valid1-Addon_id"
errors = list(
validate.checkAddonId(self.manifest, VALID_SUBMISSION_JSON_FILE, self.submissionData)
)

self.assertEqual(
[ # expected errors
],
errors
)

def test_invalidPath(self):
""" Error when submission path does not include correct addon ID
"""
Expand Down Expand Up @@ -296,7 +312,7 @@ def test_invalidAddonIdFormat_spaces(self, mock_basename):
[ # expected errors
"Submission data 'addonId' field does not match the expected format:"
" must start and end with a letter, and contain only letters,"
" numbers, and hyphens. "
" numbers, underscores, and hyphens. "
"ID: invalid addon id"
],
errors
Expand All @@ -316,7 +332,7 @@ def test_invalidAddonIdFormat_invalidStartChar(self, mock_basename):
[ # expected errors
"Submission data 'addonId' field does not match the expected format:"
" must start and end with a letter, and contain only letters,"
" numbers, and hyphens. "
" numbers, underscores, and hyphens. "
"ID: 1invalid-addon-id"
],
errors
Expand Down
4 changes: 2 additions & 2 deletions _validate/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,11 @@ def checkAddonId(
"Submission data 'addonId' field does not match 'name' field in addon manifest:"
f" {expectedName} vs {submission['addonId']}"
)
if not re.match(r"^[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9]$", expectedName):
if not re.match(r"^[A-Za-z][A-Za-z0-9\-_]*[A-Za-z0-9]$", expectedName):
yield (
"Submission data 'addonId' field does not match the expected format:"
" must start and end with a letter, and contain only letters,"
" numbers, and hyphens. "
" numbers, underscores, and hyphens. "
f"ID: {submission['addonId']}"
)

Expand Down