Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
francesconazzaro committed Dec 16, 2024
1 parent a68effb commit 3869ac6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/test_03_qos.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ def test_contains():
limit "Limit for Alice and Bob" contains(users, user): 5
limit "Limit for era5" (dataset() == "era5") && !(user in users): 10
limit "Limit for alice" "lice" in user: 1
"""
)
assert len(rules.global_limits) == 2
assert len(rules.global_limits) == 3
request_david = collections.namedtuple("SystemRequest", ["user_uid", "dataset"])(
user_uid="david", dataset="era5"
)
Expand All @@ -90,6 +91,10 @@ def test_contains():
assert not rules.global_limits[1].match(request_bob)
assert rules.global_limits[1].match(request_david)

assert rules.global_limits[2].match(request_alice)
assert not rules.global_limits[2].match(request_bob)
assert not rules.global_limits[2].match(request_david)


def test_dynamic_prorities():
request_alice = collections.namedtuple("SystemRequest", "user_uid")(
Expand Down

0 comments on commit 3869ac6

Please sign in to comment.