public async Task GetComputeKeyPairFormsCorrectUrlAndMethod() { var keyPairName = "1"; var client = new ComputeServiceRestClient(GetValidContext(), this.ServiceLocator); await client.GetKeyPair(keyPairName); Assert.AreEqual(string.Format("{0}/os-keypairs/{1}", endpoint, keyPairName), this.simulator.Uri.ToString()); Assert.AreEqual(HttpMethod.Get, this.simulator.Method); }
public async Task CanGetKeyPair() { var keyPairName = "Key1"; var keyPair = new ComputeKeyPair(keyPairName, "12345", "ABCDEF"); this.simulator.KeyPairs.Add(keyPair); var client = new ComputeServiceRestClient(GetValidContext(), this.ServiceLocator); var resp = await client.GetKeyPair(keyPairName); Assert.AreEqual(HttpStatusCode.OK, resp.StatusCode); var respContent = TestHelper.GetStringFromStream(resp.Content); Assert.IsTrue(respContent.Length > 0); }
public async Task GetComputeKeyPairIncludesAuthHeader() { var client = new ComputeServiceRestClient(GetValidContext(), this.ServiceLocator); await client.GetKeyPair("12345"); Assert.IsTrue(this.simulator.Headers.ContainsKey("X-Auth-Token")); Assert.AreEqual(this.authId, this.simulator.Headers["X-Auth-Token"]); }