Skip to content

Commit 82c25f2

Browse files
committed
Fix saml2.mdstore.MetadataStore::sbibmd_scopes as shibmd_scopes
Signed-off-by: Ivan Kanakarakis <[email protected]>
1 parent 8089049 commit 82c25f2

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/saml2/mdstore.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1543,6 +1543,15 @@ def _lookup_elements_by_key(self, root, key):
15431543
return elements
15441544

15451545
def sbibmd_scopes(self, entity_id, typ=None):
1546+
warn_msg = (
1547+
"`saml2.mdstore.MetadataStore::sbibmd_scopes` method is deprecated; "
1548+
"instead, use `saml2.mdstore.MetadataStore::shibmd_scopes`."
1549+
)
1550+
logger.warning(warn_msg)
1551+
_warn(warn_msg, DeprecationWarning)
1552+
return self.shibmd_scopes(entity_id, typ=typ)
1553+
1554+
def shibmd_scopes(self, entity_id, typ=None):
15461555
try:
15471556
md = self[entity_id]
15481557
except KeyError:

tests/test_30_mdstore.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ def test_shibmd_scope_no_regex_no_descriptor_type():
666666
mds = MetadataStore(ATTRCONV, sec_config, disable_ssl_certificate_validation=True)
667667
mds.imp(METADATACONF["15"])
668668

669-
scopes = mds.sbibmd_scopes(entity_id='http://example.com/saml2/idp.xml')
669+
scopes = mds.shibmd_scopes(entity_id='http://example.com/saml2/idp.xml')
670670
all_scopes = list(scopes)
671671

672672
expected = [
@@ -676,7 +676,7 @@ def test_shibmd_scope_no_regex_no_descriptor_type():
676676
},
677677
{
678678
"regexp": True,
679-
"text": regex_compile("descriptor-example[^0-9]*\.org"),
679+
"text": regex_compile(r"descriptor-example[^0-9]*\.org"),
680680
},
681681
]
682682
assert len(all_scopes) == 2
@@ -687,7 +687,7 @@ def test_shibmd_scope_no_regex_all_descriptors():
687687
mds = MetadataStore(ATTRCONV, sec_config, disable_ssl_certificate_validation=True)
688688
mds.imp(METADATACONF["15"])
689689

690-
scopes = mds.sbibmd_scopes(entity_id='http://example.com/saml2/idp.xml', typ="idpsso_descriptor")
690+
scopes = mds.shibmd_scopes(entity_id='http://example.com/saml2/idp.xml', typ="idpsso_descriptor")
691691
all_scopes = list(scopes)
692692
expected = [
693693
{
@@ -696,7 +696,7 @@ def test_shibmd_scope_no_regex_all_descriptors():
696696
},
697697
{
698698
"regexp": True,
699-
"text": regex_compile("descriptor-example[^0-9]*\.org"),
699+
"text": regex_compile(r"descriptor-example[^0-9]*\.org"),
700700
},
701701
{
702702
"regexp": False,

0 commit comments

Comments
 (0)