aplos-nca-saas-sdk 0.0.11__tar.gz → 0.0.13__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/.gitignore +4 -1
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/LICENSE +1 -1
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/PKG-INFO +1 -1
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/pyproject.toml +1 -1
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/src/aplos_nca_saas_sdk/integration_testing/configs/_config_base.py +7 -2
- aplos_nca_saas_sdk-0.0.13/src/aplos_nca_saas_sdk/integration_testing/configs/app_settings_config.py +88 -0
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/src/aplos_nca_saas_sdk/integration_testing/configs/config_sample.json +31 -18
- aplos_nca_saas_sdk-0.0.13/src/aplos_nca_saas_sdk/integration_testing/configs/file_upload_config.py +94 -0
- aplos_nca_saas_sdk-0.0.11/src/aplos_nca_saas_sdk/integration_testing/configs/login.py → aplos_nca_saas_sdk-0.0.13/src/aplos_nca_saas_sdk/integration_testing/configs/login_config.py +36 -23
- aplos_nca_saas_sdk-0.0.13/src/aplos_nca_saas_sdk/integration_testing/configs/nca_execution_config.py +186 -0
- aplos_nca_saas_sdk-0.0.13/src/aplos_nca_saas_sdk/integration_testing/files/executions/config1.json +46 -0
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/src/aplos_nca_saas_sdk/integration_testing/integration_test_base.py +10 -3
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/src/aplos_nca_saas_sdk/integration_testing/integration_test_configurations.py +15 -7
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/src/aplos_nca_saas_sdk/integration_testing/integration_test_factory.py +1 -1
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/src/aplos_nca_saas_sdk/integration_testing/integration_test_response.py +1 -1
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/src/aplos_nca_saas_sdk/integration_testing/integration_test_suite.py +10 -3
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/src/aplos_nca_saas_sdk/integration_testing/main.py +6 -6
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/src/aplos_nca_saas_sdk/integration_testing/readme.md +1 -1
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/src/aplos_nca_saas_sdk/integration_testing/tests/app_configuration_test.py +3 -3
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/src/aplos_nca_saas_sdk/integration_testing/tests/app_login_test.py +4 -4
- aplos_nca_saas_sdk-0.0.13/src/aplos_nca_saas_sdk/integration_testing/tests/file_upload_test.py +107 -0
- aplos_nca_saas_sdk-0.0.13/src/aplos_nca_saas_sdk/integration_testing/tests/nca_analysis_test.py +89 -0
- aplos_nca_saas_sdk-0.0.11/src/aplos_nca_saas_sdk/integration_testing/tests/app_execution_test.py → aplos_nca_saas_sdk-0.0.13/src/aplos_nca_saas_sdk/integration_testing/tests/validation_test.py +1 -1
- aplos_nca_saas_sdk-0.0.13/src/aplos_nca_saas_sdk/nca_resources/_api_base.py +44 -0
- {aplos_nca_saas_sdk-0.0.11/src/aplos_nca_saas_sdk/aws_resources → aplos_nca_saas_sdk-0.0.13/src/aplos_nca_saas_sdk/nca_resources}/aws_cognito.py +13 -7
- {aplos_nca_saas_sdk-0.0.11/src/aplos_nca_saas_sdk/aws_resources → aplos_nca_saas_sdk-0.0.13/src/aplos_nca_saas_sdk/nca_resources}/aws_s3_presigned_payload.py +3 -3
- {aplos_nca_saas_sdk-0.0.11/src/aplos_nca_saas_sdk/aws_resources → aplos_nca_saas_sdk-0.0.13/src/aplos_nca_saas_sdk/nca_resources}/aws_s3_presigned_upload.py +28 -22
- aplos_nca_saas_sdk-0.0.13/src/aplos_nca_saas_sdk/nca_resources/nca_analysis.py +304 -0
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/src/aplos_nca_saas_sdk/nca_resources/nca_app_configuration.py +4 -4
- aplos_nca_saas_sdk-0.0.11/src/aplos_nca_saas_sdk/nca_resources/nca_login.py → aplos_nca_saas_sdk-0.0.13/src/aplos_nca_saas_sdk/nca_resources/nca_authenticator.py +26 -23
- aplos_nca_saas_sdk-0.0.13/src/aplos_nca_saas_sdk/nca_resources/nca_endpoints.py +84 -0
- aplos_nca_saas_sdk-0.0.13/src/aplos_nca_saas_sdk/nca_resources/nca_file_download.py +130 -0
- aplos_nca_saas_sdk-0.0.13/src/aplos_nca_saas_sdk/nca_resources/nca_file_upload.py +55 -0
- aplos_nca_saas_sdk-0.0.13/src/aplos_nca_saas_sdk/nca_resources/nca_validations.py +34 -0
- aplos_nca_saas_sdk-0.0.13/src/aplos_nca_saas_sdk/run_analysis_execution.py +148 -0
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/src/aplos_nca_saas_sdk/utilities/commandline_args.py +32 -38
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/src/aplos_nca_saas_sdk/utilities/environment_services.py +3 -2
- aplos_nca_saas_sdk-0.0.13/src/aplos_nca_saas_sdk/utilities/environment_vars.py +36 -0
- aplos_nca_saas_sdk-0.0.13/src/aplos_nca_saas_sdk/utilities/file_utility.py +33 -0
- aplos_nca_saas_sdk-0.0.13/src/aplos_nca_saas_sdk/utilities/http_utility.py +21 -0
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/src/aplos_nca_saas_sdk/version.py +1 -1
- aplos_nca_saas_sdk-0.0.11/src/aplos_nca_saas_sdk/integration_testing/configs/app_settings.py +0 -88
- aplos_nca_saas_sdk-0.0.11/src/aplos_nca_saas_sdk/integration_testing/configs/file_upload.py +0 -104
- aplos_nca_saas_sdk-0.0.11/src/aplos_nca_saas_sdk/integration_testing/tests/app_validation_test.py +0 -5
- aplos_nca_saas_sdk-0.0.11/src/aplos_nca_saas_sdk/integration_testing/tests/file_upload_test.py +0 -155
- aplos_nca_saas_sdk-0.0.11/src/aplos_nca_saas_sdk/nca_resources/nca_endpoints.py +0 -58
- aplos_nca_saas_sdk-0.0.11/src/aplos_nca_saas_sdk/nca_resources/nca_executions.py +0 -387
- aplos_nca_saas_sdk-0.0.11/src/aplos_nca_saas_sdk/nca_resources/nca_file_upload.py +0 -57
- aplos_nca_saas_sdk-0.0.11/src/aplos_nca_saas_sdk/utilities/environment_vars.py +0 -23
- aplos_nca_saas_sdk-0.0.11/src/aplos_nca_saas_sdk/utilities/http_utility.py +0 -30
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/.pypirc +0 -0
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/.vscode/launch.json +0 -0
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/.vscode/settings.json +0 -0
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/README.md +0 -0
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/devops/pypi/build.py +0 -0
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/devops/pypi/readme.md +0 -0
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/devops/requirements.txt +0 -0
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/docs/images/API_Configuration_blur.png +0 -0
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/docs/images/aplos-nca-commandline-cropped.png +0 -0
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/docs/images/aplos-nca-commandline.png +0 -0
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/mypy.ini +0 -0
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/mypy_checks.py +0 -0
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/readme.md +0 -0
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/requirements.txt +0 -0
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/run-checks.sh +0 -0
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/src/aplos_nca_saas_sdk/__init__.py +0 -0
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/src/aplos_nca_saas_sdk/integration_testing/files/uploads/input1.csv +0 -0
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/src/aplos_nca_saas_sdk/integration_testing/files/uploads/input1.dat +0 -0
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/src/aplos_nca_saas_sdk/integration_testing/files/uploads/input1.sas7bdat +0 -0
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/src/aplos_nca_saas_sdk/integration_testing/files/uploads/input1.xls +0 -0
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/src/aplos_nca_saas_sdk/integration_testing/files/uploads/input1.xlsx +0 -0
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/src/aplos_nca_saas_sdk/integration_testing/files/uploads/input1.xpt +0 -0
- /aplos_nca_saas_sdk-0.0.11/src/aplos_nca_saas_sdk/files/analysis_files/single_ev/configuration_single_ev.json → /aplos_nca_saas_sdk-0.0.13/src/aplos_nca_saas_sdk/sample_files/analysis_files/single_ev/config.json +0 -0
- /aplos_nca_saas_sdk-0.0.11/src/aplos_nca_saas_sdk/files/analysis_files/single_ev/single_ev.csv → /aplos_nca_saas_sdk-0.0.13/src/aplos_nca_saas_sdk/sample_files/analysis_files/single_ev/input.csv +0 -0
- {aplos_nca_saas_sdk-0.0.11/src/aplos_nca_saas_sdk/files → aplos_nca_saas_sdk-0.0.13/src/aplos_nca_saas_sdk/sample_files}/analysis_files/single_ev/meta_data.json +0 -0
- {aplos_nca_saas_sdk-0.0.11 → aplos_nca_saas_sdk-0.0.13}/tests/__init__.py +0 -0
@@ -1,5 +1,10 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
"""
|
2
|
+
Copyright 2024-2025 Aplos Analytics
|
3
|
+
All Rights Reserved. www.aplosanalytics.com LICENSED MATERIALS
|
4
|
+
Property of Aplos Analytics, Utah, USA
|
5
|
+
"""
|
6
|
+
|
7
|
+
from typing import Dict, Any
|
3
8
|
|
4
9
|
|
5
10
|
class ConfigBase:
|
aplos_nca_saas_sdk-0.0.13/src/aplos_nca_saas_sdk/integration_testing/configs/app_settings_config.py
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
"""
|
2
|
+
Copyright 2024-2025 Aplos Analytics
|
3
|
+
All Rights Reserved. www.aplosanalytics.com LICENSED MATERIALS
|
4
|
+
Property of Aplos Analytics, Utah, USA
|
5
|
+
"""
|
6
|
+
|
7
|
+
from typing import List, Dict, Any
|
8
|
+
from aplos_nca_saas_sdk.integration_testing.configs._config_base import ConfigBase
|
9
|
+
|
10
|
+
|
11
|
+
class ApplicationHostConfig(ConfigBase):
|
12
|
+
"""
|
13
|
+
Application host: Defines the domains that the application configuration tests will check against
|
14
|
+
|
15
|
+
"""
|
16
|
+
|
17
|
+
def __init__(self, host: str | None = None):
|
18
|
+
super().__init__()
|
19
|
+
self.__host: str | None = host
|
20
|
+
|
21
|
+
@property
|
22
|
+
def host(self) -> str:
|
23
|
+
"""The host to validate"""
|
24
|
+
if self.__host is None:
|
25
|
+
raise RuntimeError("host is not set")
|
26
|
+
return self.__host
|
27
|
+
|
28
|
+
@host.setter
|
29
|
+
def host(self, value: str):
|
30
|
+
self.__host = value
|
31
|
+
|
32
|
+
|
33
|
+
class ApplicationDomainConfigs(ConfigBase):
|
34
|
+
"""
|
35
|
+
Application ApplicationDomain: Defines the Domains that the application configuration tests will check against
|
36
|
+
|
37
|
+
"""
|
38
|
+
|
39
|
+
def __init__(self):
|
40
|
+
super().__init__()
|
41
|
+
self.__hosts: List[ApplicationHostConfig] = []
|
42
|
+
|
43
|
+
@property
|
44
|
+
def list(self) -> List[ApplicationHostConfig]:
|
45
|
+
"""List the logins"""
|
46
|
+
return self.__hosts
|
47
|
+
|
48
|
+
def add(self, *, host: str, enabled: bool = True):
|
49
|
+
"""Add a loging"""
|
50
|
+
app_domain = ApplicationHostConfig()
|
51
|
+
app_domain.host = host
|
52
|
+
app_domain.enabled = enabled
|
53
|
+
self.__hosts.append(app_domain)
|
54
|
+
|
55
|
+
def load(self, test_config: Dict[str, Any]):
|
56
|
+
"""Load the logins from a list of dictionaries"""
|
57
|
+
# self.enabled = bool(test_config.get("enabled", True))
|
58
|
+
super().load(test_config)
|
59
|
+
domains: List[Dict[str, Any]] = test_config.get("domains", [])
|
60
|
+
|
61
|
+
host: Dict[str, Any]
|
62
|
+
for host in domains:
|
63
|
+
app_domain = ApplicationHostConfig()
|
64
|
+
app_domain.host = host.get("host", None)
|
65
|
+
app_domain.enabled = bool(host.get("enabled", True))
|
66
|
+
|
67
|
+
self.__hosts.append(app_domain)
|
68
|
+
|
69
|
+
|
70
|
+
class ApplicationSettings(ConfigBase):
|
71
|
+
"""
|
72
|
+
Application Settings: Defines the domains that the application settings (configuration endpoint) tests will check against
|
73
|
+
|
74
|
+
"""
|
75
|
+
|
76
|
+
def __init__(self):
|
77
|
+
super().__init__()
|
78
|
+
self.__hosts: ApplicationDomainConfigs = ApplicationDomainConfigs()
|
79
|
+
|
80
|
+
@property
|
81
|
+
def domains(self) -> ApplicationDomainConfigs:
|
82
|
+
"""List of the host"""
|
83
|
+
return self.__hosts
|
84
|
+
|
85
|
+
def load(self, test_config: Dict[str, Any]):
|
86
|
+
"""Load the domains from the config"""
|
87
|
+
super().load(test_config)
|
88
|
+
self.domains.load(test_config)
|
@@ -3,15 +3,15 @@
|
|
3
3
|
"purpose": "Tests the application configuration endpoints",
|
4
4
|
"domains": [
|
5
5
|
{
|
6
|
-
"
|
7
|
-
"expected_results"
|
6
|
+
"host": "api.example.com",
|
7
|
+
"expected_results": {
|
8
8
|
"status_code": 200
|
9
9
|
},
|
10
10
|
"enabled": true
|
11
11
|
},
|
12
12
|
{
|
13
|
-
"
|
14
|
-
"expected_results"
|
13
|
+
"host": "XXXXXXXXXXXXXXXXXXXXX",
|
14
|
+
"expected_results": {
|
15
15
|
"status_code": 403
|
16
16
|
},
|
17
17
|
"enabled": false
|
@@ -24,23 +24,22 @@
|
|
24
24
|
{
|
25
25
|
"username": "foo",
|
26
26
|
"password": "barr",
|
27
|
-
"
|
27
|
+
"host": "api.example.com",
|
28
28
|
"roles": []
|
29
|
-
|
30
29
|
},
|
31
30
|
{
|
32
31
|
"username": "XXXXXXXXXXXXXXXXXXXXX",
|
33
32
|
"password": "XXXXXXXXXXXXXXXXXXXXX",
|
34
|
-
"
|
33
|
+
"host": "XXXXXXXXXXXXXXXXXXXXX",
|
35
34
|
"roles": [
|
36
35
|
"XXXXXXXXXXXXXXXXXXXXX"
|
37
36
|
],
|
38
|
-
"enabled"
|
39
|
-
"expected_results"
|
37
|
+
"enabled": false,
|
38
|
+
"expected_results": {
|
40
39
|
"exception": "InvalidCredentialsException"
|
41
40
|
}
|
42
41
|
}
|
43
|
-
]
|
42
|
+
]
|
44
43
|
},
|
45
44
|
"file_upload_test": {
|
46
45
|
"purpose": "Tests the file upload endpoints.",
|
@@ -49,7 +48,7 @@
|
|
49
48
|
"purpose": "optional: if present this login is used, unless a specific login is defined for the test",
|
50
49
|
"username": "foo",
|
51
50
|
"password": "bar",
|
52
|
-
"
|
51
|
+
"host": "api.example.com"
|
53
52
|
},
|
54
53
|
"files": [
|
55
54
|
{
|
@@ -57,11 +56,11 @@
|
|
57
56
|
},
|
58
57
|
{
|
59
58
|
"file": "XXXXXXXXXXXXXXXXXXXXX",
|
60
|
-
"login"
|
59
|
+
"login": {
|
61
60
|
"purpose": "optional: if present tests an upload for a specific user",
|
62
61
|
"username": "XXXXXXXXXXXXXXXXXXXXX",
|
63
62
|
"password": "XXXXXXXXXXXXXXXXXXXXX",
|
64
|
-
"
|
63
|
+
"host": "XXXXXXXXXXXXXXXXXXXXX"
|
65
64
|
}
|
66
65
|
}
|
67
66
|
]
|
@@ -71,14 +70,29 @@
|
|
71
70
|
"login": {
|
72
71
|
"username": "XXXXXXXXXXXXXXXXXXXXX",
|
73
72
|
"password": "XXXXXXXXXXXXXXXXXXXXX",
|
74
|
-
"
|
73
|
+
"host": "XXXXXXXXXXXXXXXXXXXXX"
|
75
74
|
},
|
75
|
+
"output_dir": "XXXXXXXXXXXXXXXXXXXXX",
|
76
76
|
"analyses": [
|
77
|
-
{
|
77
|
+
{
|
78
|
+
"file": "XXXXXXXXXXXXXXXXXXXXX",
|
79
|
+
"meta": {},
|
80
|
+
"config": {},
|
81
|
+
"expected_results": {
|
82
|
+
"status_code": 200
|
83
|
+
},
|
84
|
+
"output_dir": "XXXXXXXXXXXXXXXXXXXXX"
|
85
|
+
},
|
86
|
+
{
|
78
87
|
"file": "XXXXXXXXXXXXXXXXXXXXX",
|
79
88
|
"meta": {},
|
80
89
|
"config": {},
|
81
|
-
"
|
90
|
+
"login": {
|
91
|
+
"username": "XXXXXXXXXXXXXXXXXXXXX",
|
92
|
+
"password": "XXXXXXXXXXXXXXXXXXXXX",
|
93
|
+
"host": "XXXXXXXXXXXXXXXXXXXXX"
|
94
|
+
},
|
95
|
+
"expected_results": {
|
82
96
|
"status_code": 200
|
83
97
|
}
|
84
98
|
}
|
@@ -89,11 +103,10 @@
|
|
89
103
|
"login": {
|
90
104
|
"username": "XXXXXXXXXXXXXXXXXXXXX",
|
91
105
|
"password": "XXXXXXXXXXXXXXXXXXXXX",
|
92
|
-
"
|
106
|
+
"host": "XXXXXXXXXXXXXXXXXXXXX"
|
93
107
|
},
|
94
108
|
"expected_results": {
|
95
109
|
"status_code": 200
|
96
110
|
}
|
97
111
|
}
|
98
|
-
|
99
112
|
}
|
aplos_nca_saas_sdk-0.0.13/src/aplos_nca_saas_sdk/integration_testing/configs/file_upload_config.py
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
"""
|
2
|
+
Copyright 2024-2025 Aplos Analytics
|
3
|
+
All Rights Reserved. www.aplosanalytics.com LICENSED MATERIALS
|
4
|
+
Property of Aplos Analytics, Utah, USA
|
5
|
+
"""
|
6
|
+
|
7
|
+
import os
|
8
|
+
from typing import List, Dict, Any
|
9
|
+
from aplos_nca_saas_sdk.integration_testing.configs._config_base import ConfigBase
|
10
|
+
from aplos_nca_saas_sdk.integration_testing.configs.login_config import (
|
11
|
+
LoginConfig,
|
12
|
+
LoginConfigs,
|
13
|
+
)
|
14
|
+
from aplos_nca_saas_sdk.utilities.environment_services import EnvironmentServices
|
15
|
+
from aplos_nca_saas_sdk.utilities.file_utility import FileUtility
|
16
|
+
|
17
|
+
|
18
|
+
class FileUploadConfig(ConfigBase):
|
19
|
+
"""
|
20
|
+
File Upload: Defines the login that the application configuration tests will check against
|
21
|
+
|
22
|
+
"""
|
23
|
+
|
24
|
+
def __init__(self, login: LoginConfig, file_path: str):
|
25
|
+
super().__init__()
|
26
|
+
if login is None:
|
27
|
+
raise RuntimeError("Login is required")
|
28
|
+
self.__login = login
|
29
|
+
if file_path is None:
|
30
|
+
raise RuntimeError("file_path is required")
|
31
|
+
self.__filepath = file_path
|
32
|
+
|
33
|
+
@property
|
34
|
+
def login(self) -> LoginConfig:
|
35
|
+
"""The users login"""
|
36
|
+
return self.__login
|
37
|
+
|
38
|
+
@property
|
39
|
+
def file_path(self) -> str:
|
40
|
+
"""The file path to file being uploaded"""
|
41
|
+
path = FileUtility.load_filepath(self.__filepath)
|
42
|
+
|
43
|
+
if not os.path.exists(path):
|
44
|
+
raise RuntimeError(f"The Upload File was not found: {path}")
|
45
|
+
|
46
|
+
return path
|
47
|
+
|
48
|
+
|
49
|
+
class FileUploadConfigs(ConfigBase):
|
50
|
+
"""
|
51
|
+
File Uploads: Defines the files that the application file upload tests will check against
|
52
|
+
|
53
|
+
"""
|
54
|
+
|
55
|
+
def __init__(self):
|
56
|
+
super().__init__()
|
57
|
+
self.__fileuploads: List[FileUploadConfig] = []
|
58
|
+
|
59
|
+
@property
|
60
|
+
def list(self) -> List[FileUploadConfig]:
|
61
|
+
"""List the file uploads"""
|
62
|
+
return list(filter(lambda x: x.enabled, self.__fileuploads))
|
63
|
+
|
64
|
+
def add(self, *, file_path: str, login: LoginConfig, enabled: bool = True):
|
65
|
+
"""Add a file upload"""
|
66
|
+
file_upload = FileUploadConfig(login, file_path)
|
67
|
+
file_upload.enabled = enabled
|
68
|
+
self.__fileuploads.append(file_upload)
|
69
|
+
|
70
|
+
def load(self, test_config: Dict[str, Any]):
|
71
|
+
"""Load the file uploads from a list of dictionaries"""
|
72
|
+
|
73
|
+
super().load(test_config)
|
74
|
+
test_config_login: LoginConfig | None = LoginConfigs.try_load_login(
|
75
|
+
test_config.get("login", None)
|
76
|
+
)
|
77
|
+
file_uploads: List[Dict[str, Any]] = test_config.get("files", [])
|
78
|
+
login: LoginConfig | None = None
|
79
|
+
for file_upload in file_uploads:
|
80
|
+
enabled = bool(file_upload.get("enabled", True))
|
81
|
+
if "login" in file_upload:
|
82
|
+
login = LoginConfigs.try_load_login(file_upload["login"])
|
83
|
+
else:
|
84
|
+
login = test_config_login
|
85
|
+
|
86
|
+
file_path = file_upload.get("file", None)
|
87
|
+
|
88
|
+
if not file_path:
|
89
|
+
raise RuntimeError("file_path is required")
|
90
|
+
|
91
|
+
if not login:
|
92
|
+
raise RuntimeError("login configuration is required")
|
93
|
+
|
94
|
+
self.add(file_path=file_path, login=login, enabled=enabled)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
"""
|
2
|
-
Copyright 2024 Aplos Analytics
|
2
|
+
Copyright 2024-2025 Aplos Analytics
|
3
3
|
All Rights Reserved. www.aplosanalytics.com LICENSED MATERIALS
|
4
4
|
Property of Aplos Analytics, Utah, USA
|
5
5
|
"""
|
@@ -8,7 +8,7 @@ from typing import List, Optional, Dict, Any
|
|
8
8
|
from aplos_nca_saas_sdk.integration_testing.configs._config_base import ConfigBase
|
9
9
|
|
10
10
|
|
11
|
-
class
|
11
|
+
class LoginConfig(ConfigBase):
|
12
12
|
"""
|
13
13
|
Application Login: Defines the login that the application configuration tests will check against
|
14
14
|
|
@@ -18,13 +18,13 @@ class Login(ConfigBase):
|
|
18
18
|
self,
|
19
19
|
username: Optional[str] = None,
|
20
20
|
passord: Optional[str] = None,
|
21
|
-
|
21
|
+
host: Optional[str] = None,
|
22
22
|
roles: Optional[List[str]] = None,
|
23
23
|
):
|
24
24
|
super().__init__()
|
25
25
|
self.__username: Optional[str] = username
|
26
26
|
self.__password: Optional[str] = passord
|
27
|
-
self.
|
27
|
+
self.__host: Optional[str] = host
|
28
28
|
self.__roles: List[str] = roles if roles is not None else []
|
29
29
|
|
30
30
|
@property
|
@@ -48,14 +48,15 @@ class Login(ConfigBase):
|
|
48
48
|
self.__password = value
|
49
49
|
|
50
50
|
@property
|
51
|
-
def
|
52
|
-
|
53
|
-
|
54
|
-
|
51
|
+
def host(self) -> str:
|
52
|
+
"""API Host"""
|
53
|
+
if self.__host is None:
|
54
|
+
raise RuntimeError("Host is not set")
|
55
|
+
return self.__host
|
55
56
|
|
56
|
-
@
|
57
|
-
def
|
58
|
-
self.
|
57
|
+
@host.setter
|
58
|
+
def host(self, value: str):
|
59
|
+
self.__host = value
|
59
60
|
|
60
61
|
@property
|
61
62
|
def roles(self) -> List[str]:
|
@@ -69,7 +70,7 @@ class Login(ConfigBase):
|
|
69
70
|
self.__roles = value
|
70
71
|
|
71
72
|
|
72
|
-
class
|
73
|
+
class LoginConfigs(ConfigBase):
|
73
74
|
"""
|
74
75
|
Application Logins: Defines the logins that the application configuration tests will check against
|
75
76
|
|
@@ -77,30 +78,42 @@ class Logins(ConfigBase):
|
|
77
78
|
|
78
79
|
def __init__(self):
|
79
80
|
super().__init__()
|
80
|
-
self.__logins: List[
|
81
|
+
self.__logins: List[LoginConfig] = []
|
81
82
|
|
82
83
|
@property
|
83
|
-
def list(self) -> List[
|
84
|
+
def list(self) -> List[LoginConfig]:
|
84
85
|
"""List the logins"""
|
85
86
|
return self.__logins
|
86
87
|
|
87
|
-
def add(self, *, username: str, password: str,
|
88
|
+
def add(self, *, username: str, password: str, host: str, enabled: bool = True):
|
88
89
|
"""Add a loging"""
|
89
|
-
login =
|
90
|
+
login = LoginConfig()
|
90
91
|
login.username = username
|
91
92
|
login.password = password
|
92
|
-
login.
|
93
|
+
login.host = host
|
93
94
|
login.enabled = enabled
|
94
95
|
self.__logins.append(login)
|
95
96
|
|
96
97
|
def load(self, test_config: Dict[str, Any]):
|
97
98
|
"""Load the logins from a list of dictionaries"""
|
98
|
-
|
99
|
+
|
99
100
|
super().load(test_config)
|
100
101
|
logins: List[Dict[str, str]] = test_config.get("logins", [])
|
101
102
|
for login in logins:
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
103
|
+
login_config = LoginConfigs.try_load_login(login)
|
104
|
+
if login_config is None:
|
105
|
+
continue
|
106
|
+
self.__logins.append(login_config)
|
107
|
+
|
108
|
+
@staticmethod
|
109
|
+
def try_load_login(login_config: Dict[str, Any]) -> LoginConfig | None:
|
110
|
+
"""Attempts to intialize a Login from a configuration object"""
|
111
|
+
login: LoginConfig | None = None
|
112
|
+
if login_config is not None:
|
113
|
+
username = login_config.get("username", None)
|
114
|
+
password = login_config.get("password", None)
|
115
|
+
host = login_config.get("host", None)
|
116
|
+
enabled = login_config.get("enabled", True)
|
117
|
+
login = LoginConfig(username, password, host)
|
118
|
+
login.enabled = enabled
|
119
|
+
return login
|
aplos_nca_saas_sdk-0.0.13/src/aplos_nca_saas_sdk/integration_testing/configs/nca_execution_config.py
ADDED
@@ -0,0 +1,186 @@
|
|
1
|
+
"""
|
2
|
+
Copyright 2024-2025 Aplos Analytics
|
3
|
+
All Rights Reserved. www.aplosanalytics.com LICENSED MATERIALS
|
4
|
+
Property of Aplos Analytics, Utah, USA
|
5
|
+
"""
|
6
|
+
|
7
|
+
import os
|
8
|
+
import json
|
9
|
+
from typing import Any, Dict, List
|
10
|
+
from aplos_nca_saas_sdk.integration_testing.configs._config_base import ConfigBase
|
11
|
+
from aplos_nca_saas_sdk.integration_testing.configs.login_config import (
|
12
|
+
LoginConfig,
|
13
|
+
LoginConfigs,
|
14
|
+
)
|
15
|
+
from aplos_nca_saas_sdk.utilities.file_utility import FileUtility
|
16
|
+
from aws_lambda_powertools import Logger
|
17
|
+
|
18
|
+
logger = Logger(service="NCAExecutionConfig")
|
19
|
+
|
20
|
+
|
21
|
+
class NCAExecutionConfig(ConfigBase):
|
22
|
+
"""
|
23
|
+
NCA Execution Config: Defines an NCA Execution configuration that the application execution tests will check against
|
24
|
+
|
25
|
+
"""
|
26
|
+
|
27
|
+
def __init__(
|
28
|
+
self,
|
29
|
+
login: LoginConfig,
|
30
|
+
input_file_path: str,
|
31
|
+
config_data: dict,
|
32
|
+
meta_data: str | dict | None = None,
|
33
|
+
output_dir: str | None = None,
|
34
|
+
unzip_after_download: bool = False,
|
35
|
+
):
|
36
|
+
super().__init__()
|
37
|
+
|
38
|
+
if login is None:
|
39
|
+
raise RuntimeError("login is required")
|
40
|
+
self.__login = login
|
41
|
+
|
42
|
+
if input_file_path is None:
|
43
|
+
raise RuntimeError("input_file_path is required")
|
44
|
+
self.__input_file_path = input_file_path
|
45
|
+
|
46
|
+
if config_data is None:
|
47
|
+
raise RuntimeError("config_data is required")
|
48
|
+
self.__config_data = config_data
|
49
|
+
|
50
|
+
self.__meta_data = meta_data
|
51
|
+
self.__output_dir = output_dir
|
52
|
+
self.__unzip_after_download = unzip_after_download
|
53
|
+
|
54
|
+
@property
|
55
|
+
def login(self) -> LoginConfig:
|
56
|
+
"""Login Configuration"""
|
57
|
+
return self.__login
|
58
|
+
|
59
|
+
@property
|
60
|
+
def input_file_path(self) -> str:
|
61
|
+
"""Input File Path"""
|
62
|
+
return self.__input_file_path
|
63
|
+
|
64
|
+
@property
|
65
|
+
def config_data(self) -> Dict[str, Any]:
|
66
|
+
"""Config Data"""
|
67
|
+
return self.__config_data
|
68
|
+
|
69
|
+
@property
|
70
|
+
def meta_data(self) -> str | Dict[str, Any] | None:
|
71
|
+
"""Optional Meta Data"""
|
72
|
+
return self.__meta_data
|
73
|
+
|
74
|
+
@property
|
75
|
+
def output_dir(self) -> str | None:
|
76
|
+
"""Local Output Directory"""
|
77
|
+
return self.__output_dir
|
78
|
+
|
79
|
+
@property
|
80
|
+
def unzip_after_download(self) -> bool:
|
81
|
+
"""Indicates if the download should be unzipped"""
|
82
|
+
return self.__unzip_after_download
|
83
|
+
|
84
|
+
|
85
|
+
class NCAExecutionConfigs(ConfigBase):
|
86
|
+
"""
|
87
|
+
NCA Execution Configs: Defines the configurations that the application NCA Engine tests will check against
|
88
|
+
|
89
|
+
"""
|
90
|
+
|
91
|
+
def __init__(self):
|
92
|
+
super().__init__()
|
93
|
+
self.__nca_executions: List[NCAExecutionConfig] = []
|
94
|
+
|
95
|
+
@property
|
96
|
+
def list(self) -> List[NCAExecutionConfig]:
|
97
|
+
"""List the nca execution configurations"""
|
98
|
+
return list(filter(lambda x: x.enabled, self.__nca_executions))
|
99
|
+
|
100
|
+
def add(
|
101
|
+
self,
|
102
|
+
*,
|
103
|
+
login: LoginConfig,
|
104
|
+
input_file_path: str,
|
105
|
+
config_data: dict,
|
106
|
+
meta_data: str | dict | None = None,
|
107
|
+
output_dir: str | None = None,
|
108
|
+
unzip_after_download: bool = False,
|
109
|
+
enabled: bool = True,
|
110
|
+
):
|
111
|
+
"""Add an NCA Execution Config"""
|
112
|
+
nca_excution_config = NCAExecutionConfig(
|
113
|
+
login,
|
114
|
+
input_file_path,
|
115
|
+
config_data,
|
116
|
+
meta_data,
|
117
|
+
output_dir,
|
118
|
+
unzip_after_download,
|
119
|
+
)
|
120
|
+
nca_excution_config.enabled = enabled
|
121
|
+
self.__nca_executions.append(nca_excution_config)
|
122
|
+
|
123
|
+
def load(self, test_config: Dict[str, Any]):
|
124
|
+
"""Loads the NCA Execution configs from a list of dictionaries"""
|
125
|
+
|
126
|
+
super().load(test_config)
|
127
|
+
|
128
|
+
base_login: LoginConfig | None = LoginConfigs.try_load_login(
|
129
|
+
test_config.get("login", None)
|
130
|
+
)
|
131
|
+
base_output_dir: str = test_config.get("output_dir", None)
|
132
|
+
analyses: List[Dict[str, Any]] = test_config.get("analyses", [])
|
133
|
+
for analysis in analyses:
|
134
|
+
enabled = bool(analysis.get("enabled", True))
|
135
|
+
login: LoginConfig | None = None
|
136
|
+
if "login" in analysis:
|
137
|
+
login = LoginConfigs.try_load_login(analysis["login"])
|
138
|
+
else:
|
139
|
+
login = base_login
|
140
|
+
|
141
|
+
if "output_dir" in analysis:
|
142
|
+
output_dir = analysis["output_dir"]
|
143
|
+
else:
|
144
|
+
output_dir = base_output_dir
|
145
|
+
|
146
|
+
if not login:
|
147
|
+
raise RuntimeError("Failed to load the login configuration")
|
148
|
+
|
149
|
+
self.add(
|
150
|
+
login=login,
|
151
|
+
input_file_path=analysis["file"],
|
152
|
+
config_data=self.__load_config_data(analysis=analysis),
|
153
|
+
meta_data=self.__load_meta_data(analysis=analysis),
|
154
|
+
output_dir=output_dir,
|
155
|
+
unzip_after_download=True,
|
156
|
+
enabled=enabled,
|
157
|
+
)
|
158
|
+
|
159
|
+
def __load_meta_data(self, analysis: Dict[str, Any]) -> Dict[str, Any]:
|
160
|
+
data: Dict[str, Any] = {}
|
161
|
+
data = analysis.get("meta", {}).get("data", {})
|
162
|
+
|
163
|
+
return data
|
164
|
+
|
165
|
+
def __load_config_data(self, analysis: Dict[str, Any]) -> Dict[str, Any]:
|
166
|
+
config_data: Dict[str, Any] = {}
|
167
|
+
config_data = analysis.get("config", {}).get("data")
|
168
|
+
|
169
|
+
if config_data:
|
170
|
+
return config_data
|
171
|
+
|
172
|
+
config_file_path: str = analysis.get("config", {}).get("file")
|
173
|
+
|
174
|
+
logger.info(
|
175
|
+
{
|
176
|
+
"message": "Initializing config_data from file",
|
177
|
+
"config_data": config_file_path,
|
178
|
+
}
|
179
|
+
)
|
180
|
+
config_path = FileUtility.load_filepath(config_file_path)
|
181
|
+
if os.path.exists(config_path) is False:
|
182
|
+
raise RuntimeError(f"Config file not found: {config_path}")
|
183
|
+
with open(config_path, "r", encoding="utf-8") as f:
|
184
|
+
config_data = json.load(f)
|
185
|
+
|
186
|
+
return config_data
|