Skip to content

Commit

Permalink
Schema change for issuer info in namespaces JSON:
Browse files Browse the repository at this point in the history
- `basepath` -> `base_path`
- `restrictedpath` -> `restricted_path`
  • Loading branch information
matyasselmeci committed Nov 21, 2023
1 parent b76132c commit 5cc2029
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
18 changes: 9 additions & 9 deletions src/tests/test_stashcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,13 @@ def validate_scitokens_block(sci):
assert sci["issuer"]
assert isinstance(sci["issuer"], str)
assert "://" in sci["issuer"]
assert isinstance(sci["basepath"], list)
assert sci["basepath"] # must have at least 1
for bp in sci["basepath"]:
assert isinstance(sci["base_path"], list)
assert sci["base_path"] # must have at least 1
for bp in sci["base_path"]:
assert bp.startswith("/") # implies str
assert "," not in bp
assert isinstance(sci["restrictedpath"], list)
for rp in sci["restrictedpath"]: # may be empty
assert isinstance(sci["restricted_path"], list)
for rp in sci["restricted_path"]: # may be empty
assert rp.startswith("/") # implies str
assert "," not in rp

Expand All @@ -321,8 +321,8 @@ def test_testvo_public_namespace(self, namespaces):
assert len(ns["scitokens"]) == 1
sci = ns["scitokens"][0]
assert sci["issuer"] == TEST_ISSUER
assert sci["basepath"] == [TEST_BASEPATH]
assert sci["restrictedpath"] == []
assert sci["base_path"] == [TEST_BASEPATH]
assert sci["restricted_path"] == []


def test_testvo_namespace(self, namespaces):
Expand All @@ -344,8 +344,8 @@ def test_testvo_namespace(self, namespaces):
assert len(ns["scitokens"]) == 1
sci = ns["scitokens"][0]
assert sci["issuer"] == TEST_ISSUER
assert sci["basepath"] == [TEST_BASEPATH]
assert sci["restrictedpath"] == []
assert sci["base_path"] == [TEST_BASEPATH]
assert sci["restricted_path"] == []


if __name__ == '__main__':
Expand Down
8 changes: 4 additions & 4 deletions src/webapp/data_federation.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ def get_scitokens_conf_block(self, service_name: str):
return block

def get_namespaces_scitokens_block(self):
basepath = re.split(r"\s*,\s*", self.base_path)
restrictedpath = re.split(r"\s*,\s*", self.restricted_path) if self.restricted_path else []
base_path = re.split(r"\s*,\s*", self.base_path)
restricted_path = re.split(r"\s*,\s*", self.restricted_path) if self.restricted_path else []
return {
"issuer": self.issuer,
"basepath": basepath,
"restrictedpath": restrictedpath,
"base_path": base_path,
"restricted_path": restricted_path,
}


Expand Down

0 comments on commit 5cc2029

Please sign in to comment.