コード例 #1
0
        public async Task GetComputeKeyPairsFormsCorrectUrlAndMethod()
        {
            var client =
                new ComputeServiceRestClient(GetValidContext(), this.ServiceLocator);

            await client.GetKeyPairs();

            Assert.AreEqual(string.Format("{0}/os-keypairs", endpoint), this.simulator.Uri.ToString());
            Assert.AreEqual(HttpMethod.Get, this.simulator.Method);
        }
コード例 #2
0
        public async Task CanGetKeyPairs()
        {
            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.GetKeyPairs();

            Assert.AreEqual(HttpStatusCode.OK, resp.StatusCode);

            var respContent = TestHelper.GetStringFromStream(resp.Content);
            Assert.IsTrue(respContent.Length > 0);
        }
コード例 #3
0
        public async Task GetComputeKeyPairsIncludesAuthHeader()
        {
            var client =
                new ComputeServiceRestClient(GetValidContext(), this.ServiceLocator);

            await client.GetKeyPairs();

            Assert.IsTrue(this.simulator.Headers.ContainsKey("X-Auth-Token"));
            Assert.AreEqual(this.authId, this.simulator.Headers["X-Auth-Token"]);
        }