forked from cloud-custodian/cloud-custodian
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_quicksight.py
46 lines (32 loc) · 1.43 KB
/
test_quicksight.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
from pytest_terraform import terraform
from .common import BaseTest
@terraform("quicksight_group")
def test_quicksight_group_query(test, quicksight_group):
factory = test.replay_flight_data("test_quicksight_group_query")
policy = test.load_policy({
"name": "test-aws-quicksight-group",
"resource": "aws.quicksight-group"
}, session_factory=factory, config={'account_id': '490065885863'})
resources = policy.run()
assert len(resources) > 0
assert resources[0]['GroupName'] == 'tf-example'
class TestQuicksight(BaseTest):
def test_quicksight_account_query(self):
factory = self.replay_flight_data("test_quicksight_account_query")
policy = self.load_policy({
"name": "test-aws-quicksight-account",
"resource": "aws.quicksight-account",
"filters": [{"PublicSharingEnabled": False}]
}, session_factory=factory)
resources = policy.run()
self.assertEqual(len(resources), 1)
def test_quicksight_account_get_account_not_found(self):
factory = self.replay_flight_data("test_quicksight_account_not_found")
policy = self.load_policy({
"name": "test-aws-quicksight-account",
"resource": "aws.quicksight-account"
}, session_factory=factory)
resources = policy.run()
self.assertEqual(resources, [])