Ejemplo n.º 1
0
    def test_assumed_creds_arn_valid(self, _resp_assume_role_valid):
        sts = boto3.client("sts")

        stubber = Stubber(sts)
        stubber.add_response("assume_role", _resp_assume_role_valid)

        stubber.activate()
        assumed_creds = get_assumed_creds(sts, "arn:aws:iam::123456789012:role/aws-config-role")
        stubber.deactivate()

        assert assumed_creds.get("aws_access_key_id") == "accessKeyId12345" and assumed_creds.get("aws_secret_access_key") == "secretAccessKey" and assumed_creds.get("aws_session_token") == "sessionToken"
Ejemplo n.º 2
0
 def test_assumed_creds_arn_missing(self):
     assert credential.get_assumed_creds(None, None) == {}
Ejemplo n.º 3
0
 def test_assumed_creds_arn_blank(self):
     assert credential.get_assumed_creds(None, "") == {}