Skip to content

Commit

Permalink
[uss_qualifier] Expect correct value of 'owner' in subscription_simpl…
Browse files Browse the repository at this point in the history
…e scenario (interuss#312)
  • Loading branch information
Shastick authored Nov 3, 2023
1 parent ad41f13 commit 1466e6d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
5 changes: 3 additions & 2 deletions monitoring/uss_qualifier/resources/interuss/id_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class IDGeneratorSpecification(ImplicitDict):

class IDGeneratorResource(Resource[IDGeneratorSpecification]):
id_factory: IDFactory
subscriber: str

def __init__(
self,
Expand All @@ -39,5 +40,5 @@ def __init__(
raise ValueError(
f"`sub` claim not found in payload of token using {type(auth_adapter).__name__} requesting {specification.whoami_scope} scope for {specification.whoami_audience} audience: {token}"
)
subscriber = payload["sub"]
self.id_factory = IDFactory(subscriber)
self.subscriber = payload["sub"]
self.id_factory = IDFactory(self.subscriber)
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@

TIME_TOLERANCE_SEC = 1

# TODO check if this is something that needs to be configurable.
USS_QUALIFIER_OWNER = "uss_qualifier"


class SubscriptionSimple(GenericTestScenario):
"""Based on prober/rid/v2/test_subscription_simple.py from the legacy prober tool."""
Expand All @@ -33,6 +30,9 @@ class SubscriptionSimple(GenericTestScenario):
# Base identifier for the subscriptions that will be created
_base_sub_id: str

# The value for 'owner' we'll expect the DSS to set on subscriptions
_owner: str

_test_subscription_ids: List[str]

# Base parameters used for subscription creation variations
Expand Down Expand Up @@ -74,6 +74,8 @@ def __init__(
self._isa_area_loop = self._isa_area.copy()
self._isa_area_loop.append(self._isa_area_loop[0])

self._owner = id_generator.subscriber

# Prepare 4 different subscription ids:
self._test_subscription_ids = [
self._base_sub_id[:-1] + f"{i}" for i in range(4)
Expand Down Expand Up @@ -626,11 +628,11 @@ def _validate_subscription(
with self.check(
"Returned subscription owner is correct", [self._dss_wrapper.participant_id]
) as check:
if sub_under_test.owner != USS_QUALIFIER_OWNER:
if sub_under_test.owner != self._owner:
check.record_failed(
"Returned subscription owner does not match provided one",
Severity.High,
f"Provided: {USS_QUALIFIER_OWNER}, Returned: {sub_under_test.owner}",
f"Provided: {self._owner}, Returned: {sub_under_test.owner}",
query_timestamps=query_timestamps,
)

Expand Down

0 comments on commit 1466e6d

Please sign in to comment.