From e6d17e8a7529e5927c26fc23cf1841820f867f27 Mon Sep 17 00:00:00 2001 From: Oscar Krause Date: Wed, 26 Mar 2025 22:00:52 +0100 Subject: [PATCH] added test --- .gitlab-ci.yml | 3 ++- README.md | 3 ++- src/test/test_license.py | 28 ++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 src/test/test_license.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4f93967..c1cf2ab 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,7 +20,8 @@ test: - TEST_FILE: - test_config_token.py - test_decrypt.py - - test_instance_token.py + - test_dls_instance_token.py + - test_license.py script: - echo "Testing $TEST_FILE" ... - coverage run -m pytest $TEST_FILE --junitxml=report.xml --suppress-no-test-exit-code diff --git a/README.md b/README.md index a727e68..0f9a691 100644 --- a/README.md +++ b/README.md @@ -44,5 +44,6 @@ These tests should rebuild the DLS behaviour and try to rebuild the expected out correct private-key - The test [`test_decrypt`](src/test/test_decrypt.py) currently fails, because we do not know the right de/encryption algorithms -- The test [`test_instance_token`](src/test/test_instance_token.py) currently fails, because we do not know how this is +- The test [`test_dls_instance_token`](src/test/test_dls_instance_token.py) currently fails, because we do not know how this is build +- The test [`test_license`](src/test/test_license.py) currently fails, because we do not know how this is decrypted diff --git a/src/test/test_license.py b/src/test/test_license.py new file mode 100644 index 0000000..474dc41 --- /dev/null +++ b/src/test/test_license.py @@ -0,0 +1,28 @@ +import base64 +import json + +with open('../../doc/files/license_03-26-2025-21-27-51.bin', 'rb') as f: + LICENSE = f.read().decode('utf-8') + + +def test_b64(): + payload = base64.b64decode(LICENSE) + payload = json.loads(payload) + + license_preamble = payload.get('preamble') + license_preamble_deployment_token = license_preamble.get('deployment_token') + license_preamble_product_mapping_token = license_preamble.get('product_mapping_token') + license_preamble_api_keys_response = license_preamble.get('api_keys_response') + license_preamble_dls_certificate_token = license_preamble.get('dls_certificate_token') + license_preamble_dls_feature_display_mapping_token = license_preamble.get('dls_feature_display_mapping_token') + license_payload = payload.get('payload') + + assert license_preamble is not None + assert license_preamble_deployment_token is not None + assert license_preamble_product_mapping_token is not None + assert license_preamble_api_keys_response is not None + assert license_preamble_dls_certificate_token is not None + assert license_preamble_dls_feature_display_mapping_token is not None + assert license_payload is not None + +# todo \ No newline at end of file