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
Showing only changes of commit 767added7e - Show all commits

View File

@ -529,10 +529,26 @@ class ValidateManifestFields(TestCase):
data.pop('permissions') data.pop('permissions')
ManifestValidator(data) ManifestValidator(data)
data['permissions'] = {'non-supported-permission': 'lalala'} # punctuation
data['permissions'] = {'files': 'lalala.'}
with self.assertRaises(ValidationError) as e: with self.assertRaises(ValidationError) as e:
ManifestValidator(data) ManifestValidator(data)
# empty reason
data['permissions'] = {'files': ''}
with self.assertRaises(ValidationError) as e:
ManifestValidator(data)
# too long reason
data['permissions'] = {
'files': 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
}
with self.assertRaises(ValidationError) as e:
ManifestValidator(data)
data['permissions'] = {'non-supported-permission': 'lalala'}
with self.assertRaises(ValidationError) as e:
ManifestValidator(data)
message_begin = "Manifest value error: <code>permissions</code> expects key/value pairs of" message_begin = "Manifest value error: <code>permissions</code> expects key/value pairs of"
self.assertIn(message_begin, e.exception.messages[0]) self.assertIn(message_begin, e.exception.messages[0])
self.assertIn('files, network', e.exception.messages[0]) self.assertIn('files, network', e.exception.messages[0])