added test

This commit is contained in:
Oscar Krause 2025-03-26 22:00:52 +01:00
parent 57c06759d3
commit e6d17e8a75
3 changed files with 32 additions and 2 deletions

View File

@ -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

View File

@ -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

28
src/test/test_license.py Normal file
View File

@ -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