Skip to content

Commit

Permalink
Merge pull request #1268 from Emantor/topic/test_multiple_resources_w…
Browse files Browse the repository at this point in the history
…ith_default

tests: test different resources having a default
  • Loading branch information
Emantor authored Sep 19, 2023
2 parents bff568e + 639136b commit 9d4a763
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/test_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,23 @@ class A(Resource):
with pytest.raises(NoResourceFoundError) as excinfo:
target.get_resource(A, name="nosuchresource")

def test_get_resource_multiple_with_default(target):
class A(Resource):
pass

class B(Resource):
pass

a = A(target, "aresource")
adef = A(target, "default")
b = B(target, "bresource")
bdef = B(target, "default")

assert target.get_resource(A) is adef
assert target.get_resource(B) is bdef
assert target.get_resource(A, name="aresource") is a
assert target.get_resource(B, name="bresource") is b

def test_get_driver(target):
class A(Driver):
pass
Expand Down

0 comments on commit 9d4a763

Please sign in to comment.