Permissions: change from list to key/value pairs in manifest #168
@ -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])
|
||||||
|
Loading…
Reference in New Issue
Block a user