aplos-nca-saas-sdk 0.0.2__tar.gz → 0.0.3__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.
Files changed (60) hide show
  1. aplos_nca_saas_sdk-0.0.3/PKG-INFO +91 -0
  2. aplos_nca_saas_sdk-0.0.3/README.md +66 -0
  3. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/pyproject.toml +19 -1
  4. aplos_nca_saas_sdk-0.0.3/readme.md +66 -0
  5. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/requirements.txt +2 -0
  6. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/src/aplos_nca_saas_sdk/aws_resources/aws_cognito.py +7 -5
  7. aplos_nca_saas_sdk-0.0.3/src/aplos_nca_saas_sdk/integration_testing/configs/app_config.py +25 -0
  8. aplos_nca_saas_sdk-0.0.3/src/aplos_nca_saas_sdk/integration_testing/configs/config.py +21 -0
  9. aplos_nca_saas_sdk-0.0.3/src/aplos_nca_saas_sdk/integration_testing/configs/login.py +77 -0
  10. aplos_nca_saas_sdk-0.0.3/src/aplos_nca_saas_sdk/integration_testing/integration_test_base.py +68 -0
  11. aplos_nca_saas_sdk-0.0.3/src/aplos_nca_saas_sdk/integration_testing/integration_test_response.py +28 -0
  12. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/src/aplos_nca_saas_sdk/integration_testing/integration_test_suite.py +36 -31
  13. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/src/aplos_nca_saas_sdk/integration_testing/main.py +15 -1
  14. aplos_nca_saas_sdk-0.0.3/src/aplos_nca_saas_sdk/integration_testing/tests/app_configuration_test.py +43 -0
  15. aplos_nca_saas_sdk-0.0.3/src/aplos_nca_saas_sdk/integration_testing/tests/app_login_test.py +48 -0
  16. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/src/aplos_nca_saas_sdk/nca_resources/nca_executions.py +3 -0
  17. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/src/aplos_nca_saas_sdk/nca_resources/nca_login.py +1 -1
  18. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/src/aplos_nca_saas_sdk/utilities/environment_vars.py +2 -2
  19. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/src/aplos_nca_saas_sdk/version.py +1 -1
  20. aplos_nca_saas_sdk-0.0.2/PKG-INFO +0 -57
  21. aplos_nca_saas_sdk-0.0.2/README.md +0 -33
  22. aplos_nca_saas_sdk-0.0.2/devops/code_artifacts/check_and_setup.py +0 -44
  23. aplos_nca_saas_sdk-0.0.2/devops/code_artifacts/environment_vars.py +0 -36
  24. aplos_nca_saas_sdk-0.0.2/devops/code_artifacts/local_test_support.py +0 -68
  25. aplos_nca_saas_sdk-0.0.2/devops/code_artifacts/main.py +0 -224
  26. aplos_nca_saas_sdk-0.0.2/devops/code_artifacts/pip_code_artifact_setup.py +0 -66
  27. aplos_nca_saas_sdk-0.0.2/readme.md +0 -33
  28. aplos_nca_saas_sdk-0.0.2/src/aplos_nca_saas_sdk/integration_testing/integration_test_base.py +0 -34
  29. aplos_nca_saas_sdk-0.0.2/src/aplos_nca_saas_sdk/integration_testing/tests/app_configuration_test.py +0 -30
  30. aplos_nca_saas_sdk-0.0.2/src/aplos_nca_saas_sdk/integration_testing/tests/app_login_test.py +0 -32
  31. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/.gitignore +0 -0
  32. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/.pypirc +0 -0
  33. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/.vscode/launch.json +0 -0
  34. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/.vscode/settings.json +0 -0
  35. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/LICENSE +0 -0
  36. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/devops/pypi/build.py +0 -0
  37. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/devops/pypi/readme.md +0 -0
  38. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/devops/requirements.txt +0 -0
  39. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/docs/images/API_Configuration_blur.png +0 -0
  40. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/docs/images/aplos-nca-commandline-cropped.png +0 -0
  41. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/docs/images/aplos-nca-commandline.png +0 -0
  42. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/mypy.ini +0 -0
  43. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/mypy_checks.py +0 -0
  44. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/run-checks.sh +0 -0
  45. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/src/aplos_nca_saas_sdk/__init__.py +0 -0
  46. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/src/aplos_nca_saas_sdk/aws_resources/aws_s3_presigned_payload.py +0 -0
  47. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/src/aplos_nca_saas_sdk/aws_resources/aws_s3_presigned_upload.py +0 -0
  48. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/src/aplos_nca_saas_sdk/files/analysis_files/single_ev/configuration_single_ev.json +0 -0
  49. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/src/aplos_nca_saas_sdk/files/analysis_files/single_ev/meta_data.json +0 -0
  50. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/src/aplos_nca_saas_sdk/files/analysis_files/single_ev/single_ev.csv +0 -0
  51. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/src/aplos_nca_saas_sdk/integration_testing/integration_test_factory.py +0 -0
  52. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/src/aplos_nca_saas_sdk/integration_testing/readme.md +0 -0
  53. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/src/aplos_nca_saas_sdk/integration_testing/tests/app_execution_test.py +0 -0
  54. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/src/aplos_nca_saas_sdk/integration_testing/tests/app_validation_test.py +0 -0
  55. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/src/aplos_nca_saas_sdk/nca_resources/nca_app_configuration.py +0 -0
  56. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/src/aplos_nca_saas_sdk/nca_resources/nca_endpoints.py +0 -0
  57. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/src/aplos_nca_saas_sdk/utilities/commandline_args.py +0 -0
  58. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/src/aplos_nca_saas_sdk/utilities/environment_services.py +0 -0
  59. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/src/aplos_nca_saas_sdk/utilities/http_utility.py +0 -0
  60. {aplos_nca_saas_sdk-0.0.2 → aplos_nca_saas_sdk-0.0.3}/tests/__init__.py +0 -0
@@ -0,0 +1,91 @@
1
+ Metadata-Version: 2.3
2
+ Name: aplos_nca_saas_sdk
3
+ Version: 0.0.3
4
+ Summary: Aplos NCA SaaS SDK
5
+ Project-URL: Homepage, https://aplosanalytics.com/
6
+ Project-URL: Documentation, https://docs.aplosanalytics.com/
7
+ Project-URL: Repository, https://github.com/AplosAnalytics/Aplos-NCA-SaaS-SDK
8
+ Project-URL: Issues, https://github.com/AplosAnalytics/Aplos-NCA-SaaS-SDK/issues
9
+ Author-email: Eric Wilson <eric.wilson@aplosanalytics.com>
10
+ License: MIT License
11
+ Keywords: Bioavailability Studies,Bioequivalence Studies,Clinical Pharmacology,Clinical Trials,Dose-Proportionality Studies,Drug Interaction Studies,NCA,Non-Compartmental Analysis,PK Analysis,PK modeling,Pharma Data Analysis,Pharmacokinetic Analysis,Pharmacokinetics,Pharmacokinetics Software,SaaS
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Topic :: Software Development :: Libraries
18
+ Requires-Python: >=3.10
19
+ Requires-Dist: aws-lambda-powertools==2.38.1
20
+ Requires-Dist: boto3==1.34.110
21
+ Requires-Dist: pyjwt==2.9.0
22
+ Requires-Dist: python-dotenv==1.0.1
23
+ Requires-Dist: requests==2.31.0
24
+ Description-Content-Type: text/markdown
25
+
26
+ # Aplos NCA SaaS SDK for python
27
+
28
+ Welcome to the Aplos NCA SaaS SDK for automating your PK Analyis. A secure set of API's to connect to our Cloud System and automate your PK analysis.
29
+
30
+ This SDK works for our
31
+ - Trial Accounts (Multi Tenancy)
32
+ - Academic Accounts (Multi Tenancy)
33
+ - Professional Accounts (Multi Tenancy)
34
+ - Team Accounts (Single Tenancy)
35
+ - Enterprise Accounts (Single Tenancy)
36
+
37
+ ## Use 🐍 python to perform an NCA Analysis with the Aplos NCA SaaS Solution.
38
+ If you can make HTTPS 🔐 request 🛜 - you can automation your PK Analysis Workflow Systems.
39
+
40
+ ## 👉 We use this for our demos 🚀🚀 👈
41
+ > We'll keep this maintained as we use it for our customer demo as well as Integration Testings.
42
+ > So keep coming back for new features.
43
+ >
44
+ > If you're not sure how to get started, kick off the Integration Test Suite, set some break points
45
+ > and you'll see a wide range of example use cases.
46
+
47
+ ## API Settings 🛑 A valid Aplos NCA Account is required. 🛑
48
+
49
+
50
+ > In order to run the executions and connect to our system, you will need a valid account with an active subscription (reach out for a trial subscription if you are evaluating our solutions).
51
+ >
52
+ > You'll need your username (email address and a password), a Cognito Client Id
53
+ > which allows the USER_PASSWORD_AUTH flow, and your API URL.
54
+ >
55
+ > Technically if you have your API Domain (from your account), you can use this to query for your Cognito Client Id
56
+ >
57
+ > Otherwise, the Client Id (aka Cognito Client Key) and API URL can be found in your user account.
58
+ >
59
+ > Your username is your email address and your password would have been provided to you during your
60
+ > onboarding or with a "forgot password" request and reset.
61
+
62
+
63
+ ## API
64
+ You can use the API to integrate the Aplos NCA SaaS Cloud Solution into your workflow.
65
+ You can perform:
66
+ - Logins
67
+ - File Uploads
68
+ - PK Analysis Executions
69
+ - PK Analysis Results
70
+ - File Downloads
71
+ - PK Validations (run validations against our calculations engine)
72
+ - Tenant & User Management (for Team & Enterprise Accounts)
73
+ - and more...
74
+
75
+
76
+ ## API Integration Testing
77
+ You can use the integration testing to test your environment. You can also use the Integration Testing modules
78
+ to learn how to use the API.
79
+
80
+ ## Source
81
+ Full source code can also be found on [GitHub](https://github.com/AplosAnalytics/Aplos-NCA-SaaS-SDK)
82
+
83
+ ## Documentation
84
+ [The Docs](https://docs.aplosanalytics.com/)
85
+
86
+ ## Corporate Home Page
87
+ [Aplos Analytics](https://aplosanalytics.com/)
88
+
89
+
90
+
91
+
@@ -0,0 +1,66 @@
1
+ # Aplos NCA SaaS SDK for python
2
+
3
+ Welcome to the Aplos NCA SaaS SDK for automating your PK Analyis. A secure set of API's to connect to our Cloud System and automate your PK analysis.
4
+
5
+ This SDK works for our
6
+ - Trial Accounts (Multi Tenancy)
7
+ - Academic Accounts (Multi Tenancy)
8
+ - Professional Accounts (Multi Tenancy)
9
+ - Team Accounts (Single Tenancy)
10
+ - Enterprise Accounts (Single Tenancy)
11
+
12
+ ## Use 🐍 python to perform an NCA Analysis with the Aplos NCA SaaS Solution.
13
+ If you can make HTTPS 🔐 request 🛜 - you can automation your PK Analysis Workflow Systems.
14
+
15
+ ## 👉 We use this for our demos 🚀🚀 👈
16
+ > We'll keep this maintained as we use it for our customer demo as well as Integration Testings.
17
+ > So keep coming back for new features.
18
+ >
19
+ > If you're not sure how to get started, kick off the Integration Test Suite, set some break points
20
+ > and you'll see a wide range of example use cases.
21
+
22
+ ## API Settings 🛑 A valid Aplos NCA Account is required. 🛑
23
+
24
+
25
+ > In order to run the executions and connect to our system, you will need a valid account with an active subscription (reach out for a trial subscription if you are evaluating our solutions).
26
+ >
27
+ > You'll need your username (email address and a password), a Cognito Client Id
28
+ > which allows the USER_PASSWORD_AUTH flow, and your API URL.
29
+ >
30
+ > Technically if you have your API Domain (from your account), you can use this to query for your Cognito Client Id
31
+ >
32
+ > Otherwise, the Client Id (aka Cognito Client Key) and API URL can be found in your user account.
33
+ >
34
+ > Your username is your email address and your password would have been provided to you during your
35
+ > onboarding or with a "forgot password" request and reset.
36
+
37
+
38
+ ## API
39
+ You can use the API to integrate the Aplos NCA SaaS Cloud Solution into your workflow.
40
+ You can perform:
41
+ - Logins
42
+ - File Uploads
43
+ - PK Analysis Executions
44
+ - PK Analysis Results
45
+ - File Downloads
46
+ - PK Validations (run validations against our calculations engine)
47
+ - Tenant & User Management (for Team & Enterprise Accounts)
48
+ - and more...
49
+
50
+
51
+ ## API Integration Testing
52
+ You can use the integration testing to test your environment. You can also use the Integration Testing modules
53
+ to learn how to use the API.
54
+
55
+ ## Source
56
+ Full source code can also be found on [GitHub](https://github.com/AplosAnalytics/Aplos-NCA-SaaS-SDK)
57
+
58
+ ## Documentation
59
+ [The Docs](https://docs.aplosanalytics.com/)
60
+
61
+ ## Corporate Home Page
62
+ [Aplos Analytics](https://aplosanalytics.com/)
63
+
64
+
65
+
66
+
@@ -8,7 +8,25 @@ packages = ["src/aplos_nca_saas_sdk"]
8
8
  [project]
9
9
  name = "aplos_nca_saas_sdk"
10
10
  source = "src/aplos_nca_saas_sdk"
11
- version = "0.0.2"
11
+ keywords = [
12
+ "PK Analysis",
13
+ "Pharmacokinetics",
14
+ "Non-Compartmental Analysis",
15
+ "NCA",
16
+ "PK modeling",
17
+ "SaaS",
18
+ "Clinical Pharmacology",
19
+ "Bioequivalence Studies",
20
+ "Bioavailability Studies",
21
+ "Dose-Proportionality Studies",
22
+ "Drug Interaction Studies",
23
+ "Pharmacokinetic Analysis",
24
+ "Pharmacokinetics Software",
25
+ "Pharma Data Analysis",
26
+ "Clinical Trials"
27
+ ]
28
+
29
+ version = "0.0.3"
12
30
  authors = [
13
31
  { name="Eric Wilson", email="eric.wilson@aplosanalytics.com" }
14
32
  ]
@@ -0,0 +1,66 @@
1
+ # Aplos NCA SaaS SDK for python
2
+
3
+ Welcome to the Aplos NCA SaaS SDK for automating your PK Analyis. A secure set of API's to connect to our Cloud System and automate your PK analysis.
4
+
5
+ This SDK works for our
6
+ - Trial Accounts (Multi Tenancy)
7
+ - Academic Accounts (Multi Tenancy)
8
+ - Professional Accounts (Multi Tenancy)
9
+ - Team Accounts (Single Tenancy)
10
+ - Enterprise Accounts (Single Tenancy)
11
+
12
+ ## Use 🐍 python to perform an NCA Analysis with the Aplos NCA SaaS Solution.
13
+ If you can make HTTPS 🔐 request 🛜 - you can automation your PK Analysis Workflow Systems.
14
+
15
+ ## 👉 We use this for our demos 🚀🚀 👈
16
+ > We'll keep this maintained as we use it for our customer demo as well as Integration Testings.
17
+ > So keep coming back for new features.
18
+ >
19
+ > If you're not sure how to get started, kick off the Integration Test Suite, set some break points
20
+ > and you'll see a wide range of example use cases.
21
+
22
+ ## API Settings 🛑 A valid Aplos NCA Account is required. 🛑
23
+
24
+
25
+ > In order to run the executions and connect to our system, you will need a valid account with an active subscription (reach out for a trial subscription if you are evaluating our solutions).
26
+ >
27
+ > You'll need your username (email address and a password), a Cognito Client Id
28
+ > which allows the USER_PASSWORD_AUTH flow, and your API URL.
29
+ >
30
+ > Technically if you have your API Domain (from your account), you can use this to query for your Cognito Client Id
31
+ >
32
+ > Otherwise, the Client Id (aka Cognito Client Key) and API URL can be found in your user account.
33
+ >
34
+ > Your username is your email address and your password would have been provided to you during your
35
+ > onboarding or with a "forgot password" request and reset.
36
+
37
+
38
+ ## API
39
+ You can use the API to integrate the Aplos NCA SaaS Cloud Solution into your workflow.
40
+ You can perform:
41
+ - Logins
42
+ - File Uploads
43
+ - PK Analysis Executions
44
+ - PK Analysis Results
45
+ - File Downloads
46
+ - PK Validations (run validations against our calculations engine)
47
+ - Tenant & User Management (for Team & Enterprise Accounts)
48
+ - and more...
49
+
50
+
51
+ ## API Integration Testing
52
+ You can use the integration testing to test your environment. You can also use the Integration Testing modules
53
+ to learn how to use the API.
54
+
55
+ ## Source
56
+ Full source code can also be found on [GitHub](https://github.com/AplosAnalytics/Aplos-NCA-SaaS-SDK)
57
+
58
+ ## Documentation
59
+ [The Docs](https://docs.aplosanalytics.com/)
60
+
61
+ ## Corporate Home Page
62
+ [Aplos Analytics](https://aplosanalytics.com/)
63
+
64
+
65
+
66
+
@@ -3,3 +3,5 @@ boto3
3
3
  python-dotenv # load env values
4
4
  PyJWT # jwt in the imports
5
5
  requests
6
+ boto3-stubs[cognito]
7
+ mypy_boto3_cognito_idp
@@ -4,9 +4,11 @@ All Rights Reserved. www.aplosanalytics.com LICENSED MATERIALS
4
4
  Property of Aplos Analytics, Utah, USA
5
5
  """
6
6
 
7
+ from typing import Optional
8
+
7
9
  import boto3
8
10
  import jwt as jwt_lib
9
- from typing import Optional
11
+ from mypy_boto3_cognito_idp.client import CognitoIdentityProviderClient
10
12
  from aplos_nca_saas_sdk.nca_resources.nca_app_configuration import (
11
13
  NCAAppConfiguration,
12
14
  )
@@ -31,7 +33,7 @@ class CognitoAuthenication:
31
33
  self.__access_token: Optional[str] = None
32
34
  self.__refresh_token: Optional[str] = None
33
35
  self.__region: str = region or "us-east-1"
34
- self.__client: Optional[boto3.client] = None
36
+ self.__client: Optional[CognitoIdentityProviderClient] = None
35
37
  self.__user_id: Optional[str] = None
36
38
  self.__tenant_id: Optional[str] = None
37
39
  self.__config: Optional[NCAAppConfiguration] = None
@@ -40,7 +42,7 @@ class CognitoAuthenication:
40
42
  self.__validate_parameters()
41
43
 
42
44
  @property
43
- def client(self) -> boto3.client:
45
+ def client(self) -> CognitoIdentityProviderClient:
44
46
  """
45
47
  Get the boto3 client
46
48
 
@@ -53,7 +55,7 @@ class CognitoAuthenication:
53
55
  return self.__client
54
56
 
55
57
  @property
56
- def client_id(self) -> str:
58
+ def client_id(self) -> str | None:
57
59
  """
58
60
  Client Id
59
61
  Returns:
@@ -62,7 +64,7 @@ class CognitoAuthenication:
62
64
  return self.__client_id
63
65
 
64
66
  @property
65
- def region(self) -> str:
67
+ def region(self) -> str | None:
66
68
  """
67
69
  Region
68
70
  Returns:
@@ -0,0 +1,25 @@
1
+ """
2
+ Copyright 2024 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
8
+
9
+
10
+ class TestApplicationConfiguration:
11
+ """
12
+ Application Configuration: Defines the domains that the application configuration tests will check against
13
+
14
+ """
15
+
16
+ def __init__(self):
17
+ self.__domains: List[str] = []
18
+
19
+ @property
20
+ def domains(self) -> List[str]:
21
+ return self.__domains
22
+
23
+ @domains.setter
24
+ def domains(self, value: List[str]):
25
+ self.__domains = value
@@ -0,0 +1,21 @@
1
+ """
2
+ Copyright 2024 Aplos Analytics
3
+ All Rights Reserved. www.aplosanalytics.com LICENSED MATERIALS
4
+ Property of Aplos Analytics, Utah, USA
5
+ """
6
+
7
+ from aplos_nca_saas_sdk.integration_testing.configs.app_config import (
8
+ TestApplicationConfiguration,
9
+ )
10
+ from aplos_nca_saas_sdk.integration_testing.configs.login import TestLogins
11
+
12
+
13
+ class TestConfiguration:
14
+ """
15
+ Testing Suite Configuration: Provides a way to define the testing configuration for the Aplos Analytics SaaS SDK
16
+
17
+ """
18
+
19
+ def __init__(self):
20
+ self.app_config: TestApplicationConfiguration = TestApplicationConfiguration()
21
+ self.logins: TestLogins = TestLogins()
@@ -0,0 +1,77 @@
1
+ """
2
+ Copyright 2024 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, Optional
8
+
9
+
10
+ class TestLogin:
11
+ """
12
+ Application Login: Defines the login that the application configuration tests will check against
13
+
14
+ """
15
+
16
+ def __init__(
17
+ self,
18
+ username: Optional[str] = None,
19
+ passord: Optional[str] = None,
20
+ domain: Optional[str] = None,
21
+ ):
22
+ self.__username: Optional[str] = username
23
+ self.__password: Optional[str] = passord
24
+ self.__domain: Optional[str] = domain
25
+
26
+ @property
27
+ def username(self) -> str:
28
+ if self.__username is None:
29
+ raise RuntimeError("Username is not set")
30
+ return self.__username
31
+
32
+ @username.setter
33
+ def username(self, value: str):
34
+ self.__username = value
35
+
36
+ @property
37
+ def password(self) -> str:
38
+ if self.__password is None:
39
+ raise RuntimeError("Password is not set")
40
+ return self.__password
41
+
42
+ @password.setter
43
+ def password(self, value: str):
44
+ self.__password = value
45
+
46
+ @property
47
+ def domain(self) -> str:
48
+ if self.__domain is None:
49
+ raise RuntimeError("Domain is not set")
50
+ return self.__domain
51
+
52
+ @domain.setter
53
+ def domain(self, value: str):
54
+ self.__domain = value
55
+
56
+
57
+ class TestLogins:
58
+ """
59
+ Application Logins: Defines the logins that the application configuration tests will check against
60
+
61
+ """
62
+
63
+ def __init__(self):
64
+ self.__logins: List[TestLogin] = []
65
+
66
+ @property
67
+ def list(self) -> List[TestLogin]:
68
+ """List the logins"""
69
+ return self.__logins
70
+
71
+ def add(self, *, username: str, password: str, domain: str):
72
+ """Add a loging"""
73
+ login = TestLogin()
74
+ login.username = username
75
+ login.password = password
76
+ login.domain = domain
77
+ self.__logins.append(login)
@@ -0,0 +1,68 @@
1
+ """
2
+ Copyright 2024 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, List
8
+
9
+ from aplos_nca_saas_sdk.integration_testing.configs.config import TestConfiguration
10
+ from aplos_nca_saas_sdk.integration_testing.integration_test_response import (
11
+ IntegrationTestResponse,
12
+ )
13
+
14
+
15
+ class IntegrationTestBase:
16
+ """
17
+ Integration Test Base Class
18
+ """
19
+
20
+ def __init__(self, name: str | None = None, index: int = 0):
21
+ self.name = name
22
+ self.index = index
23
+ self.__config: TestConfiguration | None = None
24
+ self.__results: List[IntegrationTestResponse] = []
25
+
26
+ @property
27
+ def config(self) -> TestConfiguration:
28
+ """
29
+ Get the configuration for the test
30
+ """
31
+ if self.__config is None:
32
+ raise RuntimeError(
33
+ "Test configuration not set. "
34
+ "A configuration is required to run integration tests."
35
+ )
36
+ return self.__config
37
+
38
+ @config.setter
39
+ def config(self, value: TestConfiguration):
40
+ """
41
+ Set the configuration for the test
42
+ """
43
+ self.__config = value
44
+
45
+ @property
46
+ def results(self) -> List[IntegrationTestResponse]:
47
+ """
48
+ Get the results of the test
49
+ """
50
+ return self.__results
51
+
52
+ def success(self) -> bool:
53
+ """
54
+ Returns True if all tests in the suite were successful
55
+ """
56
+ return all([result.success for result in self.results])
57
+
58
+ def test(self) -> bool:
59
+ """
60
+ Run the Test
61
+ Args:
62
+ config: The Test Configuration
63
+ Returns:
64
+ True if the test was successful, False otherwise. If any
65
+ of the tests fail, it will be false. Execeptions are only
66
+ raised if the raise_on_failure flag is set to True.
67
+ """
68
+ raise RuntimeError("This should be implemented by the subclass.")
@@ -0,0 +1,28 @@
1
+ """
2
+ Copyright 2024 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, Optional
8
+
9
+
10
+ class IntegrationTestResponse:
11
+ """Integration Test Response"""
12
+
13
+ def __init__(self):
14
+ self.name: str = ""
15
+ self.meta: Dict[str, Any] = {}
16
+ self.response: Dict[str, Any] = {}
17
+ self.error: Optional[str] = None
18
+ self.success: bool = False
19
+
20
+ def to_dict(self) -> Dict[str, Any]:
21
+ """JSON Dictionary Object"""
22
+ return {
23
+ "name": self.name,
24
+ "meta": self.meta,
25
+ "response": self.response,
26
+ "error": self.error,
27
+ "success": self.success,
28
+ }
@@ -12,6 +12,7 @@ from aplos_nca_saas_sdk.integration_testing.integration_test_factory import (
12
12
  from aplos_nca_saas_sdk.integration_testing.integration_test_base import (
13
13
  IntegrationTestBase,
14
14
  )
15
+ from aplos_nca_saas_sdk.integration_testing.configs.config import TestConfiguration
15
16
 
16
17
 
17
18
  class IntegrationTestSuite:
@@ -22,63 +23,67 @@ class IntegrationTestSuite:
22
23
  self.verbose: bool = False
23
24
  self.raise_on_failure: bool = False
24
25
 
25
- def test(self) -> bool:
26
+ def test(self, test_config: TestConfiguration) -> bool:
26
27
  """Run a full suite of integration tests"""
28
+
29
+ # reset the test results
30
+ self.test_results = []
31
+
27
32
  start_time: datetime = datetime.now(UTC)
28
33
  factory: IntegrationTestFactory = IntegrationTestFactory()
29
- test_class: IntegrationTestBase | None = None
30
- for test_class in factory.test_classes:
31
- test_instance: IntegrationTestBase = test_class
32
- test: Dict[str, Any] = {
33
- "test_name": test_instance.name,
34
+ test: IntegrationTestBase | None = None
35
+ for test in factory.test_classes:
36
+ test.config = test_config
37
+ test_result: Dict[str, Any] = {
38
+ "test_name": test.name,
34
39
  "success": True,
35
40
  "error": None,
36
41
  "start_time_utc": datetime.now(UTC),
37
42
  "end_time_utc": None,
38
43
  }
39
44
  if self.verbose:
40
- print(f"Running test class {test_instance.name}")
45
+ print(f"Running test class {test.name}")
41
46
  try:
42
- results = test_instance.test()
43
- test["results"] = results
44
-
47
+ success = test.test()
48
+ test_result["success"] = success
49
+ test_result["results"] = test.results
45
50
  except Exception as e: # pylint: disable=broad-except
46
- test["success"] = False
47
- test["error"] = str(e)
51
+ test_result["success"] = False
52
+ test_result["error"] = str(e)
48
53
 
49
- test["end_time_utc"] = datetime.now(UTC)
50
- self.test_results.append(test)
54
+ test_result["end_time_utc"] = datetime.now(UTC)
55
+ self.test_results.append(test_result)
51
56
 
52
57
  if self.verbose:
53
- if test["success"]:
54
- print(f"Test {test_instance.name} succeeded")
58
+ if test_result["success"]:
59
+ print(f"Test {test.name} succeeded")
55
60
  else:
56
- print(
57
- f"Test {test_instance.name} failed with error {test['error']}"
58
- )
61
+ print(f"Test {test.name} failed with error {test_result['error']}")
59
62
  # find the failures
60
63
  failures = [test for test in self.test_results if not test["success"]]
64
+ self.__print_results(start_time, failures)
61
65
 
62
66
  # print the results
63
67
 
68
+ if self.raise_on_failure and len(failures) > 0:
69
+ count = len(failures)
70
+ print(f"{count} tests failed. Raising exception.")
71
+ raise RuntimeError(f"{count} tests failed")
72
+
73
+ return len(failures) == 0
74
+
75
+ def __print_results(self, start_time: datetime, failures: List[Dict[str, Any]]):
64
76
  print("Test Results:")
65
- for test in self.test_results:
66
- duration = test["end_time_utc"] - test["start_time_utc"]
77
+ for test_result in self.test_results:
78
+ duration = test_result["end_time_utc"] - test_result["start_time_utc"]
67
79
  print(
68
- f" {test['test_name']} {'succeeded' if test['success'] else 'failed'} duration: {duration}"
80
+ f" {test_result['test_name']} {'succeeded' if test_result['success'] else 'failed'} duration: {duration}"
69
81
  )
70
- if not test["success"]:
71
- print(f" Error: {test['error']}")
82
+ if not test_result["success"]:
83
+ print(f" Error: {test_result['error']}")
72
84
 
73
85
  print(f"Test Suite completed in {datetime.now(UTC) - start_time}")
74
86
 
75
87
  print(f"Total Tests: {len(self.test_results)}")
76
88
  print(f"Successful Tests: {len(self.test_results) - len(failures)}")
77
89
  print(f"Failed Tests: {len(failures)}")
78
-
79
- if self.raise_on_failure and len(failures) > 0:
80
- count = len(failures)
81
- print(f"{count} tests failed. Raising exception.")
82
- raise RuntimeError(f"{count} tests failed")
83
-
84
- return len(failures) == 0
@@ -9,6 +9,7 @@ from aplos_nca_saas_sdk.utilities.environment_services import EnvironmentService
9
9
  from aplos_nca_saas_sdk.integration_testing.integration_test_suite import (
10
10
  IntegrationTestSuite,
11
11
  )
12
+ from aplos_nca_saas_sdk.integration_testing.configs.config import TestConfiguration
12
13
 
13
14
 
14
15
  def main():
@@ -21,7 +22,20 @@ def main():
21
22
  evs.load_environment(starting_path=__file__, file_name=env_file)
22
23
 
23
24
  its: IntegrationTestSuite = IntegrationTestSuite()
24
- its.test()
25
+ config: TestConfiguration = TestConfiguration()
26
+ username = os.getenv("TEST_USERNAME")
27
+ password = os.getenv("TEST_PASSWORD")
28
+ domain = os.getenv("TEST_DOMAIN")
29
+
30
+ if not username or not password or not domain:
31
+ raise RuntimeError(
32
+ "TEST_USERNAME, TEST_PASSWORD, and TEST_DOMAIN must be set in the environment"
33
+ )
34
+
35
+ config.logins.add(username=username, password=password, domain=domain)
36
+ config.app_config.domains.append(domain)
37
+
38
+ its.test(test_config=config)
25
39
 
26
40
 
27
41
  if __name__ == "__main__":