From 334f5a90a460fe4f963099308dbfb1d4f111ac3c Mon Sep 17 00:00:00 2001 From: Oleh Bohzok Date: Tue, 29 Oct 2024 20:45:11 +0200 Subject: [PATCH] test(jans-cedarling): fix python unit tests Signed-off-by: Oleh Bohzok --- .../example_files/policy-store.json | 30 ++++++++----------- .../bindings/cedarling_python/tests/config.py | 2 +- .../tests/test_policy_store.py | 4 +-- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/jans-cedarling/bindings/cedarling_python/example_files/policy-store.json b/jans-cedarling/bindings/cedarling_python/example_files/policy-store.json index 0241250a49c..43bf7ee30a3 100644 --- a/jans-cedarling/bindings/cedarling_python/example_files/policy-store.json +++ b/jans-cedarling/bindings/cedarling_python/example_files/policy-store.json @@ -1,20 +1,16 @@ { - "8b805e22fdd39f3dd33a13d9fb446d8e6314153ca997": { - "name": "gluustore", - "description": "gluu", - "policies": { - "840da5d85403f35ea76519ed1a18a33989f855bf1cf8": { - "description": "simple policy example for principal workload", - "creation_date": "2024-09-20T17:22:39.996050", - "policy_content": "cGVybWl0KAogICAgcHJpbmNpcGFsIGlzIEphbnM6Oldvcmtsb2FkLAogICAgYWN0aW9uIGluIFtKYW5zOjpBY3Rpb246OiJVcGRhdGUiXSwKICAgIHJlc291cmNlIGlzIEphbnM6Oklzc3VlCil3aGVuewogICAgcHJpbmNpcGFsLm9yZ19pZCA9PSByZXNvdXJjZS5vcmdfaWQKfTs=" - }, - "444da5d85403f35ea76519ed1a18a33989f855bf1cf8": { - "description": "simple policy example for principal user", - "creation_date": "2024-09-20T17:22:39.996050", - "policy_content": "cGVybWl0KAogICAgcHJpbmNpcGFsIGlzIEphbnM6OlVzZXIsCiAgICBhY3Rpb24gaW4gW0phbnM6OkFjdGlvbjo6IlVwZGF0ZSJdLAogICAgcmVzb3VyY2UgaXMgSmFuczo6SXNzdWUKKXdoZW57CiAgICBwcmluY2lwYWwuY291bnRyeSA9PSByZXNvdXJjZS5jb3VudHJ5Cn07" - } + "cedar_version": "v2.4.7", + "cedar_policies": { + "840da5d85403f35ea76519ed1a18a33989f855bf1cf8": { + "description": "simple policy example for principal workload", + "creation_date": "2024-09-20T17:22:39.996050", + "policy_content": "cGVybWl0KAogICAgcHJpbmNpcGFsIGlzIEphbnM6Oldvcmtsb2FkLAogICAgYWN0aW9uIGluIFtKYW5zOjpBY3Rpb246OiJVcGRhdGUiXSwKICAgIHJlc291cmNlIGlzIEphbnM6Oklzc3VlCil3aGVuewogICAgcHJpbmNpcGFsLm9yZ19pZCA9PSByZXNvdXJjZS5vcmdfaWQKfTs=" }, - "identity_source": {}, - "schema": "eyJKYW5zIjp7ImNvbW1vblR5cGVzIjp7IlVybCI6eyJ0eXBlIjoiUmVjb3JkIiwiYXR0cmlidXRlcyI6eyJob3N0Ijp7InR5cGUiOiJFbnRpdHlPckNvbW1vbiIsIm5hbWUiOiJTdHJpbmcifSwicGF0aCI6eyJ0eXBlIjoiRW50aXR5T3JDb21tb24iLCJuYW1lIjoiU3RyaW5nIn0sInByb3RvY29sIjp7InR5cGUiOiJFbnRpdHlPckNvbW1vbiIsIm5hbWUiOiJTdHJpbmcifX19fSwiZW50aXR5VHlwZXMiOnsiV29ya2xvYWQiOnsic2hhcGUiOnsidHlwZSI6IlJlY29yZCIsImF0dHJpYnV0ZXMiOnsiY2xpZW50X2lkIjp7InR5cGUiOiJFbnRpdHlPckNvbW1vbiIsIm5hbWUiOiJTdHJpbmcifSwiaXNzIjp7InR5cGUiOiJFbnRpdHlPckNvbW1vbiIsIm5hbWUiOiJUcnVzdGVkSXNzdWVyIn0sIm5hbWUiOnsidHlwZSI6IkVudGl0eU9yQ29tbW9uIiwibmFtZSI6IlN0cmluZyJ9LCJvcmdfaWQiOnsidHlwZSI6IkVudGl0eU9yQ29tbW9uIiwibmFtZSI6IlN0cmluZyJ9fX19LCJVc2VyIjp7InNoYXBlIjp7InR5cGUiOiJSZWNvcmQiLCJhdHRyaWJ1dGVzIjp7ImNvdW50cnkiOnsidHlwZSI6IkVudGl0eU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l0eU9yQ29tbW9uIiwibmFtZSI6IlN0cmluZyJ9LCJleHAiOnsidHlwZSI6IkVudGl0eU9yQ29tbW9uIiwibmFtZSI6IkxvbmcifSwiaWF0Ijp7InR5cGUiOiJFbnRpdHlPckNvbW1vbiIsIm5hbWUiOiJMb25nIn0sImlzcyI6eyJ0eXBlIjoiRW50aXR5T3JDb21tb24iLCJuYW1lIjoiVHJ1c3RlZElzc3VlciJ9LCJqdGkiOnsidHlwZSI6IkVudGl0eU9yQ29tbW9uIiwibmFtZSI6IlN0cmluZyJ9LCJzdWIiOnsidHlwZSI6IkVudGl0eU9yQ29tbW9uIiwibmFtZSI6IlN0cmluZyJ9fX19LCJUcnVzdGVkSXNzdWVyIjp7InNoYXBlIjp7InR5cGUiOiJSZWNvcmQiLCJhdHRyaWJ1dGVzIjp7Imlzc3Vlcl9lbnRpdHlfaWQiOnsidHlwZSI6IkVudGl0eU9yQ29tbW9uIiwibmFtZSI6IlVybCJ9fX19fSwiYWN0aW9ucyI6eyJVcGRhdGUiOnsiYXBwbGllc1RvIjp7InJlc291cmNlVHlwZXMiOlsiSXNzdWUiXSwicHJpbmNpcGFsVHlwZXMiOlsiV29ya2xvYWQiLCJVc2VyIl19fX19fQo=" - } + "444da5d85403f35ea76519ed1a18a33989f855bf1cf8": { + "description": "simple policy example for principal user", + "creation_date": "2024-09-20T17:22:39.996050", + "policy_content": "cGVybWl0KAogICAgcHJpbmNpcGFsIGlzIEphbnM6OlVzZXIsCiAgICBhY3Rpb24gaW4gW0phbnM6OkFjdGlvbjo6IlVwZGF0ZSJdLAogICAgcmVzb3VyY2UgaXMgSmFuczo6SXNzdWUKKXdoZW57CiAgICBwcmluY2lwYWwuY291bnRyeSA9PSByZXNvdXJjZS5jb3VudHJ5Cn07" + } + }, + "cedar_schema": "eyJKYW5zIjp7ImNvbW1vblR5cGVzIjp7IlVybCI6eyJ0eXBlIjoiUmVjb3JkIiwiYXR0cmlidXRlcyI6eyJob3N0Ijp7InR5cGUiOiJ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HRyaWJ1dGVzIjp7Imlzc3Vlcl9lbnRpdHlfaWQiOnsidHlwZSI6IkVudGl0eU9yQ29tbW9uIiwibmFtZSI6IlVybCJ9fX19fSwiYWN0aW9ucyI6eyJVcGRhdGUiOnsiYXBwbGllc1RvIjp7InJlc291cmNlVHlwZXMiOlsiSXNzdWUiXSwicHJpbmNpcGFsVHlwZXMiOlsiV29ya2xvYWQiLCJVc2VyIl19fX19fQo=" } \ No newline at end of file diff --git a/jans-cedarling/bindings/cedarling_python/tests/config.py b/jans-cedarling/bindings/cedarling_python/tests/config.py index 4e4f6d8f4bb..8a5a53b385a 100644 --- a/jans-cedarling/bindings/cedarling_python/tests/config.py +++ b/jans-cedarling/bindings/cedarling_python/tests/config.py @@ -29,7 +29,7 @@ def sample_bootstrap_config(): policy_source = PolicyStoreSource(json=policy_raw_json) policy_store_config = PolicyStoreConfig( - source=policy_source, store_id=None) + source=policy_source) jwt_config = JwtConfig(enabled=False) diff --git a/jans-cedarling/bindings/cedarling_python/tests/test_policy_store.py b/jans-cedarling/bindings/cedarling_python/tests/test_policy_store.py index 1df13a12490..d34dff41504 100644 --- a/jans-cedarling/bindings/cedarling_python/tests/test_policy_store.py +++ b/jans-cedarling/bindings/cedarling_python/tests/test_policy_store.py @@ -20,14 +20,14 @@ ("policy-store_policy_err_broken_utf8.json", "unable to decode policy_content to utf8 string"), ("policy-store_policy_err_broken_policy.json", - 'unable to decode policy with id: 840da5d85403f35ea76519ed1a18a33989f855bf1cf8, error: unable to decode policy_content from human readable format: unexpected token `)` at line 15 column 1'), + "unable to decode policy with id: 840da5d85403f35ea76519ed1a18a33989f855bf1cf8, error: unable to decode policy_content from human readable format: unexpected token `)`"), # cases with schema errors ("policy-store_schema_err_base64.json", "unable to decode cedar policy schema base64"), ("policy-store_schema_err_json.json", "unable to unmarshal cedar policy schema json to the structure"), ("policy-store_schema_err_cedar_mistake.json", - "Could not load policy: unable to parse cedar policy schema json: failed to resolve type: User_TypeNotExist at line 35 column 1"), + "Could not load policy: failed to parse the policy store from `policy_store.json`: unable to parse cedar policy schema json: failed to resolve type: User_TypeNotExist at line 32 column 1"), ]