-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dashboard Integration Test Improvements (#1623)
### Feature or Bugfix <!-- please choose --> - Test Enhancement ### Detail - Add documentation in README on how to set up dashboard tests - Add check for QS Account and skip if no Account exists in `session_env1` ### Relates ### Security Please answer the questions below briefly where applicable, or write `N/A`. Based on [OWASP 10](https://owasp.org/Top10/en/). - Does this PR introduce or modify any input fields or queries - this includes fetching data from storage outside the application (e.g. a database, an S3 bucket)? - Is the input sanitized? - What precautions are you taking before deserializing the data you consume? - Is injection prevented by parametrizing queries? - Have you ensured no `eval` or similar functions are used? - Does this PR introduce any functionality or component that requires authorization? - How have you ensured it respects the existing AuthN/AuthZ mechanisms? - Are you logging failed auth attempts? - Are you using or adding any cryptographic features? - Do you use a standard proven implementations? - Are the used keys controlled by the customer? Where are they stored? - Are you introducing any new policies/roles/users? - Have you used the least-privilege principle? How? By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
- Loading branch information
1 parent
abbb10a
commit 1a0c4b5
Showing
5 changed files
with
84 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
tests_new/integration_tests/modules/dashboards/aws_clients.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import logging | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
|
||
class QuickSightClient: | ||
def __init__(self, session, account_id, region): | ||
self._client = session.client('quicksight', region_name=region) | ||
self._region = region | ||
self._account_id = account_id | ||
|
||
def check_enterprise_account_exists(self): | ||
""" | ||
Check if a QuickSight Account exists in the account. | ||
:param | ||
:return: True if the account exists, False otherwise | ||
""" | ||
try: | ||
response = self._client.describe_account_subscription(AwsAccountId=self._account_id) | ||
if not response['AccountInfo']: | ||
log.info(f'Quicksight Enterprise Subscription not found in Account: {self._account_id}') | ||
return False | ||
else: | ||
if response['AccountInfo']['Edition'] not in ['ENTERPRISE', 'ENTERPRISE_AND_Q']: | ||
log.info( | ||
f"Quicksight Subscription found in Account: {self._account_id} of incorrect type: {response['AccountInfo']['Edition']}" | ||
) | ||
return False | ||
else: | ||
if response['AccountInfo']['AccountSubscriptionStatus'] == 'ACCOUNT_CREATED': | ||
return True | ||
log.info( | ||
f"Quicksight Subscription found in Account: {self._account_id} not active. Status = {response['AccountInfo']['AccountSubscriptionStatus']}" | ||
) | ||
return False | ||
except self._client.exceptions.ResourceNotFoundException: | ||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters