Skip to content

Commit 4d5a09c

Browse files
committed
Unittests: Add support for assets
1 parent 7a1e586 commit 4d5a09c

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

tests/test.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -433,22 +433,22 @@ def _test_release(self, package_name, data, library, main_repo=True):
433433
if library:
434434
condition = (
435435
'base' in data
436-
and ('tags' in data or 'branch' in data)
436+
and any(d in data for d in ('asset', 'tags', 'branch'))
437437
or ('sha256' in data
438438
and ('url' not in data
439439
or data['url'].startswith('http://')))
440440
)
441441
self.assertTrue(condition,
442-
'A release must have a "base" and a "tags" or "branch" key '
442+
'A release must have a "base" and an "asset", "tags" or "branch" key '
443443
'if it is in the main repository. For custom '
444444
'releases, a custom repository.json file must be '
445445
'hosted elsewhere. The only exception to this rule '
446446
'is for packages that can not be served over HTTPS '
447447
'since they help bootstrap proper secure HTTP '
448448
'support for Sublime Text.')
449449
else:
450-
self.assertTrue(('tags' in data or 'branch' in data),
451-
'A release must have a "tags" key or "branch" key '
450+
self.assertTrue(any(d in data for d in ('asset', 'tags', 'branch')),
451+
'A release must have an "asset", "tags" or "branch" key '
452452
'if it is in the main repository. For custom '
453453
'releases, a custom repository.json file must be '
454454
'hosted elsewhere.')
@@ -458,7 +458,7 @@ def _test_release(self, package_name, data, library, main_repo=True):
458458
'used in the main repository since a pull '
459459
'request would be necessary for every release')
460460

461-
elif 'tags' not in data and 'branch' not in data:
461+
elif not any(d in data for d in ('asset', 'tags', 'branch')):
462462
if library:
463463
for key in ('url', 'version'):
464464
self.assertIn(key, data,
@@ -481,6 +481,10 @@ def _test_release(self, package_name, data, library, main_repo=True):
481481
'A release must have only one of the "tags" or '
482482
'"branch" keys.')
483483

484+
self.assertFalse(('asset' in data and 'branch' in data),
485+
'A release must have only one of the "asset" or '
486+
'"branch" keys.')
487+
484488
# Test keys values
485489
self.check_release_key_values(data, library)
486490

0 commit comments

Comments
 (0)