@@ -16,6 +16,18 @@ class TestEntraIdCredentialsProvider:
1616 {
1717 "idp_kwargs" : {"auth_type" : AuthType .SERVICE_PRINCIPAL },
1818 },
19+ ],
20+ ids = ["Service principal" ],
21+ indirect = True ,
22+ )
23+ def test_get_credentials (self , credential_provider : EntraIdCredentialsProvider ):
24+ credentials = credential_provider .get_credentials ()
25+ assert len (credentials ) == 2
26+
27+
28+ @pytest .mark .parametrize (
29+ "credential_provider" ,
30+ [
1931 {
2032 "idp_kwargs" : {"auth_type" : AuthType .MANAGED_IDENTITY },
2133 },
@@ -26,20 +38,35 @@ class TestEntraIdCredentialsProvider:
2638 },
2739 }
2840 ],
29- ids = ["Service principal" , " Managed Identity (System-assigned)" , "Managed Identity (User-assigned)" ],
41+ ids = ["Managed Identity (System-assigned)" , "Managed Identity (User-assigned)" ],
3042 indirect = True ,
3143 )
32- def test_get_credentials (self , credential_provider : EntraIdCredentialsProvider ):
44+ @pytest .mark .managed_identity
45+ def test_get_credentials_managed_identity (self , credential_provider : EntraIdCredentialsProvider ):
3346 credentials = credential_provider .get_credentials ()
3447 assert len (credentials ) == 2
3548
49+
3650 @pytest .mark .parametrize (
3751 "credential_provider" ,
3852 [
3953 {
4054 "cred_provider_kwargs" : {"block_for_initial" : False },
4155 "idp_kwargs" : {"auth_type" : AuthType .SERVICE_PRINCIPAL },
4256 },
57+ ],
58+ ids = ["Service principal" ],
59+ indirect = True ,
60+ )
61+ @pytest .mark .asyncio
62+ async def test_get_credentials_async (self , credential_provider : EntraIdCredentialsProvider ):
63+ credentials = await credential_provider .get_credentials_async ()
64+ assert len (credentials ) == 2
65+
66+
67+ @pytest .mark .parametrize (
68+ "credential_provider" ,
69+ [
4370 {
4471 "cred_provider_kwargs" : {"block_for_initial" : True },
4572 "idp_kwargs" : {"auth_type" : AuthType .MANAGED_IDENTITY },
@@ -51,14 +78,16 @@ def test_get_credentials(self, credential_provider: EntraIdCredentialsProvider):
5178 },
5279 }
5380 ],
54- ids = ["Service principal" , " Managed Identity (System-assigned)" , "Managed Identity (User-assigned)" ],
81+ ids = ["Managed Identity (System-assigned)" , "Managed Identity (User-assigned)" ],
5582 indirect = True ,
5683 )
5784 @pytest .mark .asyncio
58- async def test_get_credentials_async (self , credential_provider : EntraIdCredentialsProvider ):
85+ @pytest .mark .managed_identity
86+ async def test_get_credentials_async_managed_identity (self , credential_provider : EntraIdCredentialsProvider ):
5987 credentials = await credential_provider .get_credentials_async ()
6088 assert len (credentials ) == 2
6189
90+
6291 @pytest .mark .parametrize (
6392 "credential_provider" ,
6493 [
0 commit comments