@@ -659,16 +659,14 @@ async def test_workload_identity_provider_is_required_for_wif_authenticator(
659659 "provider_param" ,
660660 [
661661 # Strongly-typed values.
662- AttestationProvider .AWS ,
663662 AttestationProvider .AZURE ,
664663 AttestationProvider .OIDC ,
665664 # String values.
666- "AWS" ,
667665 "AZURE" ,
668666 "OIDC" ,
669667 ],
670668)
671- async def test_workload_identity_impersonation_path_unsupported_for_non_gcp_providers (
669+ async def test_workload_identity_impersonation_path_errors_for_unsupported_providers (
672670 monkeypatch , provider_param
673671):
674672 async def mock_authenticate (* _ ):
@@ -690,20 +688,22 @@ async def mock_authenticate(*_):
690688 ],
691689 )
692690 assert (
693- "workload_identity_impersonation_path is currently only supported for GCP."
691+ "workload_identity_impersonation_path is currently only supported for GCP and AWS ."
694692 in str (excinfo .value )
695693 )
696694
697695
698696@pytest .mark .parametrize (
699- "provider_param" ,
697+ "provider_param,impersonation_path " ,
700698 [
701- AttestationProvider .GCP ,
702- "GCP" ,
699+ (AttestationProvider .GCP , ["sa2@project.iam.gserviceaccount.com" ]),
700+ (AttestationProvider .AWS , ["arn:aws:iam::1234567890:role/role2" ]),
701+ ("GCP" , ["sa2@project.iam.gserviceaccount.com" ]),
702+ ("AWS" , ["arn:aws:iam::1234567890:role/role2" ]),
703703 ],
704704)
705- async def test_workload_identity_impersonation_path_supported_for_gcp_provider (
706- monkeypatch , provider_param
705+ async def test_workload_identity_impersonation_path_populates_auth_class_for_supported_provider (
706+ monkeypatch , provider_param , impersonation_path
707707):
708708 async def mock_authenticate (* _ ):
709709 pass
@@ -718,14 +718,9 @@ async def mock_authenticate(*_):
718718 account = "account" ,
719719 authenticator = "WORKLOAD_IDENTITY" ,
720720 workload_identity_provider = provider_param ,
721- workload_identity_impersonation_path = [
722- "sa2@project.iam.gserviceaccount.com"
723- ],
721+ workload_identity_impersonation_path = impersonation_path ,
724722 )
725- assert conn .auth_class .provider == AttestationProvider .GCP
726- assert conn .auth_class .impersonation_path == [
727- "sa2@project.iam.gserviceaccount.com"
728- ]
723+ assert conn .auth_class .impersonation_path == impersonation_path
729724
730725
731726@pytest .mark .parametrize (
0 commit comments