@@ -660,16 +660,14 @@ async def test_workload_identity_provider_is_required_for_wif_authenticator(
660660 "provider_param" ,
661661 [
662662 # Strongly-typed values.
663- AttestationProvider .AWS ,
664663 AttestationProvider .AZURE ,
665664 AttestationProvider .OIDC ,
666665 # String values.
667- "AWS" ,
668666 "AZURE" ,
669667 "OIDC" ,
670668 ],
671669)
672- async def test_workload_identity_impersonation_path_unsupported_for_non_gcp_providers (
670+ async def test_workload_identity_impersonation_path_errors_for_unsupported_providers (
673671 monkeypatch , provider_param
674672):
675673 async def mock_authenticate (* _ ):
@@ -691,20 +689,22 @@ async def mock_authenticate(*_):
691689 ],
692690 )
693691 assert (
694- "workload_identity_impersonation_path is currently only supported for GCP."
692+ "workload_identity_impersonation_path is currently only supported for GCP and AWS ."
695693 in str (excinfo .value )
696694 )
697695
698696
699697@pytest .mark .parametrize (
700- "provider_param" ,
698+ "provider_param,impersonation_path " ,
701699 [
702- AttestationProvider .GCP ,
703- "GCP" ,
700+ (AttestationProvider .GCP , ["[email protected] " ]), 701+ (AttestationProvider .AWS , ["arn:aws:iam::1234567890:role/role2" ]),
702+ 703+ ("AWS" , ["arn:aws:iam::1234567890:role/role2" ]),
704704 ],
705705)
706- async def test_workload_identity_impersonation_path_supported_for_gcp_provider (
707- monkeypatch , provider_param
706+ async def test_workload_identity_impersonation_path_populates_auth_class_for_supported_provider (
707+ monkeypatch , provider_param , impersonation_path
708708):
709709 async def mock_authenticate (* _ ):
710710 pass
@@ -719,14 +719,9 @@ async def mock_authenticate(*_):
719719 account = "account" ,
720720 authenticator = "WORKLOAD_IDENTITY" ,
721721 workload_identity_provider = provider_param ,
722- workload_identity_impersonation_path = [
723- 724- ],
722+ workload_identity_impersonation_path = impersonation_path ,
725723 )
726- assert conn .auth_class .provider == AttestationProvider .GCP
727- assert conn .auth_class .impersonation_path == [
728- 729- ]
724+ assert conn .auth_class .impersonation_path == impersonation_path
730725
731726
732727@pytest .mark .parametrize (
0 commit comments