6
6
using IntelliTect . Management . Automation . UnitTesting ;
7
7
using Microsoft . VisualStudio . TestTools . UnitTesting ;
8
8
using ExposedObject ;
9
+ using IntelliTect . Security ;
9
10
10
11
namespace IntelliTect . PSDropbin . Tests
11
12
{
@@ -399,5 +400,31 @@ public void RemoveItem_ExistingItem_Success()
399
400
RemoveItem ( path ) ;
400
401
AttemptAssertion ( ( ) => TestPath ( path ) , false ) ;
401
402
}
403
+
404
+ [ TestMethod ]
405
+ public void RemoveCredentials_WithSavedCredentials_Success ( )
406
+ {
407
+ string credentialName = "RemoveCredentialsTest" ;
408
+ string accessTokenCredentialName = DropboxDriveInfo . GetDropboxAccessTokenName ( credentialName ) ;
409
+ CredentialManager . WriteCredential ( accessTokenCredentialName , "TestAccessToken" ) ;
410
+ string refreshTokenCredentialName = DropboxDriveInfo . GetDropboxRefreshTokenName ( credentialName ) ;
411
+ CredentialManager . WriteCredential ( refreshTokenCredentialName , "TestRefreshToken" ) ;
412
+
413
+ var result = PowerShellInvoke ( "Remove-DropboxCredential {0}" , credentialName ) ;
414
+
415
+ var actual = ( string ) result . First ( ) . BaseObject ;
416
+ Assert . AreEqual ( "Credentials removed. You may wish to also revoke access in your Dropbox user profile." , actual ) ;
417
+ }
418
+
419
+ [ TestMethod ]
420
+ public void RemoveCredentials_WithoutSavedCredentials_ReturnsNoCredentialsFound ( )
421
+ {
422
+ string credentialName = "RemoveCredentialsTest" ;
423
+
424
+ var result = PowerShellInvoke ( "Remove-DropboxCredential {0}" , credentialName ) ;
425
+
426
+ var actual = ( string ) result . First ( ) . BaseObject ;
427
+ Assert . AreEqual ( "No credential found." , actual ) ;
428
+ }
402
429
}
403
430
}
0 commit comments