Permissions: change from list to key/value pairs in manifest #168

Merged
Oleg-Komarov merged 6 commits from permissions-dict into main 2024-06-04 17:34:33 +02:00
2 changed files with 17 additions and 0 deletions
Showing only changes of commit dc298d5c8a - Show all commits

Binary file not shown.

View File

@ -63,6 +63,22 @@ EXPECTED_EXTENSION_DATA = {
'version_str': '1.0.8', 'version_str': '1.0.8',
'slug': 'amaranth', 'slug': 'amaranth',
}, },
'addon-with-permissions.zip': {
'metadata': {
'tagline': 'Some add-on tag line',
'name': 'Some Add-on',
'id': 'some_addon',
'version': '0.1.0',
'blender_version_min': '4.2.0',
'type': 'add-on',
'permissions': {'files': 'reading files', 'network': 'talking to server'},
},
'file_hash': 'sha256:cce5f6268cb096cf8b070b17cab78ad2bc10f2ff85c625ef4a2b6db7c01a29ad',
'size_bytes': 748,
'tags': [],
'version_str': '0.1.0',
'slug': 'some-addon',
},
} }
EXPECTED_VALIDATION_ERRORS = { EXPECTED_VALIDATION_ERRORS = {
'empty.txt': {'source': ['Only .zip files are accepted.']}, 'empty.txt': {'source': ['Only .zip files are accepted.']},
@ -147,6 +163,7 @@ class SubmitFileTest(TestCase):
self.assertEqual(file.hash, file_hash) self.assertEqual(file.hash, file_hash)
self.assertEqual(file.get_type_display(), 'Add-on') self.assertEqual(file.get_type_display(), 'Add-on')
self.assertEqual(file.metadata['version'], version_str) self.assertEqual(file.metadata['version'], version_str)
self.assertEqual(file.metadata.get('permissions'), other_metadata.get('permissions'))
def test_not_allowed_anonymous(self): def test_not_allowed_anonymous(self):
with open(TEST_FILES_DIR / 'edit_breakdown-0.1.0.zip', 'rb') as fp: with open(TEST_FILES_DIR / 'edit_breakdown-0.1.0.zip', 'rb') as fp: