Beispiel #1
0
    def __init__(self,
                 quicksight_application=None,
                 type=None,
                 sub_type=None,
                 props=None):
        self.quicksight_application = quicksight_application
        self.aws_account_id = get_aws_account_id()
        self.aws_region = get_aws_region()
        self.aws_partition = get_aws_partition()
        self.principal_arn = quicksight_application.quicksight_principal_arn

        self.type = type
        self.sub_type = sub_type
        self.prefix = quicksight_application.prefix

        self.id = None
        self.name = None
        self.arn = None
        self.url = None

        self._initialize_identity()
        self._update_arn()
        self._update_url()

        self.config_data = dict()
    def __init__(self, quicksight_application=None, props=None):
        self.quicksight_application = quicksight_application
        self.aws_account_id = get_aws_account_id()
        self.aws_region = get_aws_region()
        self.aws_partion = get_aws_partition()
        self.principal_arn = quicksight_application.quicksight_principal_arn

        self.type = None
        self.prefix = quicksight_application.prefix

        self.id = None
        self.name = None
        self.arn = None
        self.url = None
        self.config_data = dict()
def test_get_aws_region(monkeypatch):
    """Set the SECRET env var to assert the behavior."""
    monkeypatch.setenv("SECRET", "top_secret")
    # See mocked aws_environment_variables in conftest.py
    assert get_aws_region() == "us-east-1"
def test_get_region_us_west_2(monkeypatch):
    """Set the SECRET env var to assert the behavior."""
    monkeypatch.setenv('AWS_REGION', 'us-west-2')
    assert get_aws_region() == 'us-west-2'
    assert get_aws_partition() == 'aws'
def test_us_gov_cloud_partition(monkeypatch):
    """Set the SECRET env var to assert the behavior."""
    monkeypatch.setenv('AWS_REGION', 'us-gov-east-1')
    assert get_aws_region() == 'us-gov-east-1'
    assert get_aws_partition() == 'aws-us-gov'
def test_cn_partition(monkeypatch):
    """Set the SECRET env var to assert the behavior."""
    monkeypatch.setenv('AWS_REGION', 'cn-north-1')
    assert get_aws_region() == 'cn-north-1'
    assert get_aws_partition() == 'aws-cn'
def test_aws_partition():
    region = os.environ.pop("AWS_REGION")
    with pytest.raises(EnvironmentVariableError):
        get_aws_region()
    os.environ["AWS_REGION"] = region