Skip to content

Commit ca63795

Browse files
committed
make test_blacklist more specific and explicit
- don't load unrelated metadata - actually ensure the reason the entity id isn't present is because of the filtering
1 parent c2b4cfa commit ca63795

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

src/pyff/test/test_pipeline.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -637,22 +637,39 @@ def test_pick_invalid(self):
637637
pass
638638

639639
def test_blacklist(self):
640+
entity = 'https://idp.example.com/saml2/idp/metadata.php'
641+
642+
# First, load without a filter to ensure the entity is there
643+
try:
644+
res, md = self.exec_pipeline(
645+
f"""
646+
- when batch:
647+
- load:
648+
- {self.datadir}/metadata/test01.xml
649+
"""
650+
)
651+
except IOError:
652+
pass
653+
print(md.lookup(entity))
654+
assert md.lookup(entity)
655+
656+
# Then, load with a filter and ensure the entity isn't there anymore
640657
try:
641658
res, md = self.exec_pipeline(
642659
f"""
643660
- when batch:
644661
- load:
645-
- {self.datadir}/metadata via blacklist_example
662+
- {self.datadir}/metadata/test01.xml via blacklist_example
646663
- when blacklist_example:
647664
- fork merge remove:
648665
- filter:
649-
- https://idp.example.com/saml2/idp/metadata.php
666+
- {entity}
650667
"""
651668
)
652669
except IOError:
653670
pass
654-
print(md.lookup('https://idp.example.com/saml2/idp/metadata.php'))
655-
assert not md.lookup('https://idp.example.com/saml2/idp/metadata.php')
671+
print(md.lookup(entity))
672+
assert not md.lookup(entity)
656673

657674
def test_bad_namespace(self):
658675
try:

0 commit comments

Comments
 (0)