public void AuthenticateTestForValidRequests(AuthenticationTestFixture testCase) { var escher = new Escher { Config = testCase.config.ToEscherConfig() }; var apiKey = escher.Authenticate(testCase.request, testCase.KeyDb, testCase.config.DateTime); Assert.AreEqual(testCase.expected.apiKey, apiKey); }
public void AuthenticateTestForValidRequests(AuthenticationTestFixture testCase) { var escher = new Escher { Config = testCase.config.ToEscherConfig() }; var apiKey = escher.Authenticate(testCase.request, testCase.KeyDb, testCase.config.DateTime); Assert.AreEqual(testCase.expected.apiKey, apiKey); }
public void AuthenticateTestForInvalidRequests(AuthenticationTestFixture testCase) { var escher = new Escher { Config = testCase.config.ToEscherConfig() }; try { escher.Authenticate(testCase.request, testCase.KeyDb, testCase.config.DateTime); Assert.Fail("Authentication should have failed"); } catch (EscherAuthenticationException e) { Assert.AreEqual(testCase.expected.error, e.Message); } }
public void SignRequestTest(SigningTestFixture testCase) { var escher = new Escher { Config = testCase.config.ToEscherConfig() }; var signedRequest = escher.SignRequest( testCase.request, testCase.config.accessKeyId, testCase.config.apiSecret, testCase.headersToSign, testCase.config.DateTime ); Assert.AreEqual(testCase.expected.request, signedRequest); }
public void AuthenticateTestForInvalidRequests(AuthenticationTestFixture testCase) { var escher = new Escher { Config = testCase.config.ToEscherConfig() }; try { escher.Authenticate(testCase.request, testCase.KeyDb, testCase.config.DateTime); Assert.Fail("Authentication should have failed"); } catch (EscherAuthenticationException e) { Assert.AreEqual(testCase.expected.error, e.Message); } }
public void AuthenticateSignedGetRequest() { var escher = new Escher(); var request = new TestRequest { Method = "GET", Uri = new Uri("http://localhost:1234/asd?a=b"), Headers = new List <Header> { new Header("key", "value") } }; request = escher.SignRequest(request, "escher_key", "escher_key_secret"); var validatedKey = escher.Authenticate(request, new TestKeyDb()); Assert.AreEqual("escher_key", validatedKey); }
public void AuthenticateSignedPatchRequest() { var escher = new Escher(); var request = new TestRequest { Method = "PATCH", Uri = new Uri("http://localhost:1234/users/123"), Headers = new List <Header> { new Header("Content-Type", "application/json") }, Body = "{\"name\":\"Joe\"}" }; request = escher.SignRequest(request, "escher_key", "escher_key_secret"); var validatedKey = escher.Authenticate(request, new TestKeyDb()); Assert.AreEqual("escher_key", validatedKey); }
public void SignRequestTest(SigningTestFixture testCase) { var escher = new Escher { Config = testCase.config.ToEscherConfig() }; var signedRequest = escher.SignRequest( testCase.request, testCase.config.accessKeyId, testCase.config.apiSecret, testCase.headersToSign, testCase.config.DateTime ); Assert.AreEqual(testCase.expected.request, signedRequest); }
public void AuthenticateSignedPatchRequest() { var escher = new Escher(); var request = new TestRequest { Method = "PATCH", Uri = new Uri("http://localhost:1234/users/123"), Headers = new List<Header> { new Header("Content-Type", "application/json") }, Body = "{\"name\":\"Joe\"}" }; request = escher.SignRequest(request, "escher_key", "escher_key_secret"); var validatedKey = escher.Authenticate(request, new TestKeyDb()); Assert.AreEqual("escher_key", validatedKey); }
public void AuthenticateSignedGetRequest() { var escher = new Escher(); var request = new TestRequest { Method = "GET", Uri = new Uri("http://localhost:1234/asd?a=b"), Headers = new List<Header> { new Header("key", "value") } }; request = escher.SignRequest(request, "escher_key", "escher_key_secret"); var validatedKey = escher.Authenticate(request, new TestKeyDb()); Assert.AreEqual("escher_key", validatedKey); }