Skip to content

Commit 8e6f8fd

Browse files
committed
Add an integration test for looking up retrieved resources.
Really we will need one for repeated lookup, which is... broken :/ and needs fixing. But this is the bit that works already.
1 parent f63574f commit 8e6f8fd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

referencing/tests/test_core.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ def retrieve(uri):
441441
registry = Registry({"urn:example": foo})
442442
assert registry["urn:example"] == foo
443443

444-
def test_retrieve_crawlable_resource(self):
444+
def test_retrieve_first_checks_crawlable_resource(self):
445445
def retrieve(uri):
446446
raise Exception("Oh no!")
447447

@@ -692,6 +692,12 @@ def test_lookup_non_existent_anchor(self):
692692
anchor="noSuchAnchor",
693693
)
694694

695+
def test_lookup_retrieved_resource(self):
696+
resource = Resource.opaque(contents={"foo": "baz"})
697+
resolver = Registry(retrieve=lambda uri: resource).resolver()
698+
resolved = resolver.lookup("http://example.com/")
699+
assert resolved.contents == resource.contents
700+
695701
# FIXME: The tests below aren't really representable in the current
696702
# suite, though we should probably think of ways to do so.
697703

0 commit comments

Comments
 (0)