From 5cc2029f933139587f56ea1da20ee30f068b3625 Mon Sep 17 00:00:00 2001 From: Matyas Selmeci Date: Tue, 21 Nov 2023 13:45:57 -0600 Subject: [PATCH] Schema change for issuer info in namespaces JSON: - `basepath` -> `base_path` - `restrictedpath` -> `restricted_path` --- src/tests/test_stashcache.py | 18 +++++++++--------- src/webapp/data_federation.py | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/tests/test_stashcache.py b/src/tests/test_stashcache.py index c9817245a..a1390095f 100644 --- a/src/tests/test_stashcache.py +++ b/src/tests/test_stashcache.py @@ -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 @@ -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): @@ -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__': diff --git a/src/webapp/data_federation.py b/src/webapp/data_federation.py index 5c252a958..5f6ab796a 100644 --- a/src/webapp/data_federation.py +++ b/src/webapp/data_federation.py @@ -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, }