def test_validate__prefs_incorrect_type__exception_raised( self, valid_manifest): valid_manifest['preferences'] = [{'id': 'id', 'type': 'incorrect'}] manifest = ExtensionManifest(valid_manifest) with pytest.raises(ExtensionManifestError) as e: manifest.validate() assert e.value.error_name == ExtensionError.InvalidManifest.value
def test_validate__prefs_empty_id__exception_raised( self, ext_dir, valid_manifest): valid_manifest['preferences'] = [{}] manifest = ExtensionManifest('test_extension', valid_manifest, ext_dir) with pytest.raises(ExtensionManifestError) as e: manifest.validate() assert e.value.error_name == ErrorName.InvalidManifestJson.value
def test_validate__raises_error_if_empty_default_value_for_keyword( self, valid_manifest): valid_manifest['preferences'] = [{ 'id': 'id', 'type': 'keyword', 'name': 'My Keyword' }] manifest = ExtensionManifest(valid_manifest) with pytest.raises(ExtensionManifestError) as e: manifest.validate() assert e.value.error_name == ExtensionError.InvalidManifest.value
def test_validate__type_kw_empty_name__exception_raised( self, ext_dir, valid_manifest): valid_manifest['preferences'] = [{ 'id': 'id', 'type': 'incorrect', 'keyword': 'kw' }] manifest = ExtensionManifest('test_extension', valid_manifest, ext_dir) with pytest.raises(ExtensionManifestError) as e: manifest.validate() assert e.value.error_name == ErrorName.InvalidManifestJson.value
def test_validate__doesnt_raise_if_empty_default_value_for_non_keyword( self, valid_manifest): valid_manifest['preferences'] = [ { 'id': 'id', 'type': 'keyword', 'name': 'My Keyword', 'default_value': 'kw' }, { 'id': 'city', 'type': 'input', 'name': 'City' }, ] manifest = ExtensionManifest(valid_manifest) manifest.validate()
def test_validate__prefs_empty_id__exception_raised(self, valid_manifest): valid_manifest['preferences'] = [{}] manifest = ExtensionManifest(valid_manifest) with pytest.raises(ExtensionManifestError) as e: manifest.validate() assert e.value.error_name == ExtensionError.InvalidManifest.value
def test_validate__valid_manifest__no_exceptions_raised( self, valid_manifest): manifest = ExtensionManifest(valid_manifest) manifest.validate()
def test_validate__name_empty__exception_raised(self): manifest = ExtensionManifest({"required_api_version": "1"}) with pytest.raises(ExtensionManifestError) as e: manifest.validate() assert e.value.error_name == ExtensionError.InvalidManifest.value
def test_validate__valid_manifest__no_exceptions_raised( self, ext_dir, valid_manifest): manifest = ExtensionManifest('test_extension', valid_manifest, ext_dir) manifest.validate()
def test_validate__name_empty__exception_raised(self, ext_dir): manifest = ExtensionManifest('test_extension', {'required_api_version': '1'}, ext_dir) with pytest.raises(ExtensionManifestError) as e: manifest.validate() assert e.value.error_name == ErrorName.InvalidManifestJson.value