public void TestValidOAuthHeader() { String dummyMethod = "post"; String dummyUrl = "http://example.com"; String dummyApiToken = "oauth.abcdefffff.yyyyassaldjf="; String dummyApiVersion = "2018-02-08"; MockAPIResource resource = new MockAPIResource(dummyApiToken); resource.SetApiVersion(dummyApiVersion); WebRequest request = resource.SetupRequestTest(dummyMethod, dummyUrl); Assert.AreEqual("Bearer " + dummyApiToken, request.Headers.Get("Authorization")); Assert.AreEqual(dummyApiVersion, request.Headers.Get("Shippo-API-Version")); }
public void TestValidHeader() { String dummyMethod = "post"; String dummyUrl = "http://example.com"; String dummyApiToken = "1234abcd"; String dummyApiVersion = "2014-02-11"; MockAPIResource resource = new MockAPIResource(dummyApiToken); resource.SetApiVersion(dummyApiVersion); WebRequest request = resource.SetupRequestTest(dummyMethod, dummyUrl); Assert.AreEqual("ShippoToken " + dummyApiToken, request.Headers.Get("Authorization")); Assert.AreEqual(dummyApiVersion, request.Headers.Get("Shippo-API-Version")); }
public void TestValidHeader() { var dummyMethod = HttpMethod.Post; string dummyUrl = "http://example.com"; string dummyApiToken = "1234abcd"; string dummyApiVersion = "2014-02-11"; var resource = new MockAPIResource(dummyApiToken); resource.ApiVersion = dummyApiVersion; HttpRequestMessage request = resource.SetupRequestTest(dummyMethod, dummyUrl); Assert.AreEqual("ShippoToken " + dummyApiToken, request.Headers.GetValues("Authorization").First()); Assert.AreEqual(dummyApiVersion, request.Headers.GetValues("Shippo-API-Version").First()); }