Skip to content

Commit dd467e6

Browse files
mamiksikfilak-sap
authored andcommitted
Add Microsoft's edm namespace to whitelisted
Resolves: SAP#16
1 parent e297ebf commit dd467e6

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

pyodata/v2/model.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2037,6 +2037,7 @@ def sap_attribute_get_bool(node, attr, default):
20372037

20382038
EDM_WHITELIST = [
20392039
'http://schemas.microsoft.com/ado/2008/09/edm',
2040+
'http://schemas.microsoft.com/ado/2009/11/edm',
20402041
'http://docs.oasis-open.org/odata/ns/edm'
20412042
]
20422043

tests/test_model_v2.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -897,3 +897,17 @@ def test_unsupported_schema_n(mock_from_etree, metadata_builder_factory):
897897
assert str(ex) == f'Unsupported Schema namespace - {edm}'
898898

899899
mock_from_etree.assert_called_once()
900+
901+
902+
@patch.object(Schema, 'from_etree')
903+
def test_whitelisted_edm_namespace(mock_from_etree, metadata_builder_factory):
904+
"""Test correct handling of whitelisted Microsoft's edm namespace"""
905+
906+
builder = metadata_builder_factory()
907+
builder.namespaces['edm'] = 'http://schemas.microsoft.com/ado/2009/11/edm'
908+
builder.add_schema('', '')
909+
xml = builder.serialize()
910+
911+
Edmx.parse(xml)
912+
assert Schema.from_etree is mock_from_etree
913+
mock_from_etree.assert_called_once()

0 commit comments

Comments
 (0)