conjur-api-dotnet
conjur-api-dotnet copied to clipboard
Fix Failing Tests Using GetToken()
- [ ] api-dotnet.test.Conjur.Test.AuthenticatorTest.TestTokenCaching
- [ ] api-dotnet.test.Conjur.Test.AuthenticatorTest.TestTokenThreadSafe
- [ ] api-dotnet.test.Conjur.Test.ClientTest.TestLogin
These 3 tests are commented out, but fail when run. They use the GetToken() method in the ApiKeyAuthenticator class. This method uses:
HttpWebRequest request = WebRequest.CreateHttp(this.uri);
which causes an error, because the test uri is "test:///". The method expects an http uri, so it throws an error.
Notes:
- I looked into using WebMocker, but I am unfamiliar with it. When I tried to override the WebRequest.CreateHttp() in WebMocker it told me that the method was not overridable.
- There is a MockAuthenticator class that just returns "token" when you call GetToken(), but these tests are to make sure the authenticator is working and that would circumvent a good portion of the test.