18
18
using Microsoft . Azure . Commands . Common . Authentication . Models ;
19
19
using Microsoft . Azure . Commands . Profile ;
20
20
using Microsoft . Azure . Commands . Profile . Models ;
21
+ using Microsoft . Azure . Commands . Profile . Test ;
21
22
using Microsoft . Azure . Commands . ScenarioTest ;
22
23
using Microsoft . Azure . Internal . Subscriptions . Models ;
23
24
using Microsoft . Azure . ServiceManagemenet . Common . Models ;
24
- using Microsoft . IdentityModel . Clients . ActiveDirectory ;
25
25
using Microsoft . Rest ;
26
26
using Microsoft . Rest . Azure ;
27
27
using Microsoft . WindowsAzure . Commands . Common ;
@@ -901,12 +901,11 @@ public void LoadingProfileWorks()
901
901
902
902
[ Fact ]
903
903
[ Trait ( Category . AcceptanceType , Category . CheckIn ) ]
904
- public void CanRenwTokenLogin ( )
904
+ public void CanRenewTokenLogin ( )
905
905
{
906
906
var tenants = new List < string > { DefaultTenant . ToString ( ) } ;
907
907
var subscriptions = new List < string > { DefaultSubscription . ToString ( ) } ;
908
908
var profile = SetupLogin ( tenants , subscriptions , subscriptions ) ;
909
-
910
909
var cmdlet = new AddAzureRMAccountCommand ( ) ;
911
910
cmdlet . CommandRuntime = new MockCommandRuntime ( ) ;
912
911
cmdlet . DefaultProfile = profile ;
@@ -931,7 +930,6 @@ public void CanRenwTokenLogin()
931
930
Assert . Equal ( graphToken1 , account . GetProperty ( AzureAccount . Property . GraphAccessToken ) ) ;
932
931
Assert . True ( account . IsPropertySet ( AzureAccount . Property . KeyVaultAccessToken ) ) ;
933
932
Assert . Equal ( keyVaultToken1 , account . GetProperty ( AzureAccount . Property . KeyVaultAccessToken ) ) ;
934
-
935
933
var toss = SetupLogin ( tenants , subscriptions , subscriptions ) ;
936
934
var cmdlet2 = new AddAzureRMAccountCommand ( ) ;
937
935
cmdlet2 . CommandRuntime = new MockCommandRuntime ( ) ;
@@ -956,7 +954,6 @@ public void CanRenwTokenLogin()
956
954
Assert . Equal ( graphToken2 , account . GetProperty ( AzureAccount . Property . GraphAccessToken ) ) ;
957
955
Assert . True ( account . IsPropertySet ( AzureAccount . Property . KeyVaultAccessToken ) ) ;
958
956
Assert . Equal ( keyVaultToken2 , account . GetProperty ( AzureAccount . Property . KeyVaultAccessToken ) ) ;
959
-
960
957
var factory = new ClientFactory ( ) ;
961
958
var rmClient = factory . CreateArmClient < MockServiceClient > ( profile . DefaultContext , AzureEnvironment . Endpoint . ResourceManager ) ;
962
959
var rmCred = rmClient . Credentials as TokenCredentials ;
@@ -966,7 +963,6 @@ public void CanRenwTokenLogin()
966
963
Assert . NotNull ( message . Headers . Authorization ) ;
967
964
Assert . NotNull ( message . Headers . Authorization . Parameter ) ;
968
965
Assert . Contains ( accessToken2 , message . Headers . Authorization . Parameter ) ;
969
-
970
966
var graphClient = factory . CreateArmClient < MockServiceClient > ( profile . DefaultContext , AzureEnvironment . Endpoint . Graph ) ;
971
967
var graphCred = graphClient . Credentials as TokenCredentials ;
972
968
Assert . NotNull ( graphCred ) ;
@@ -1011,24 +1007,4 @@ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
1011
1007
}
1012
1008
}
1013
1009
}
1014
- public class MockServiceClient : ServiceClient < MockServiceClient >
1015
- {
1016
- public MockServiceClient ( Uri uri , ServiceClientCredentials credentials )
1017
- {
1018
- BaseUri = uri ;
1019
- Credentials = credentials ;
1020
- }
1021
-
1022
- public MockServiceClient ( Uri uri , ServiceClientCredentials credentials , params DelegatingHandler [ ] handlers )
1023
- {
1024
- BaseUri = uri ;
1025
- Credentials = credentials ;
1026
- }
1027
-
1028
- public string SubscriptionId { get ; set ; }
1029
-
1030
- public ServiceClientCredentials Credentials { get ; set ; }
1031
-
1032
- public Uri BaseUri { get ; set ; }
1033
- }
1034
1010
}
0 commit comments