Example #1
0
        public async Task GetComputeFlavorIncludesAuthHeader()
        {
            var client =
                new ComputeServiceRestClient(GetValidContext(), this.ServiceLocator);

            await client.GetFlavor("1");

            Assert.IsTrue(this.simulator.Headers.ContainsKey("X-Auth-Token"));
            Assert.AreEqual(this.authId, this.simulator.Headers["X-Auth-Token"]);
        }
Example #2
0
        public async Task GetComputeFlavorFormsCorrectUrlAndMethod()
        {
            var flavorId = "1";
            var client   =
                new ComputeServiceRestClient(GetValidContext(), this.ServiceLocator);

            await client.GetFlavor(flavorId);

            Assert.AreEqual(string.Format("{0}/flavors/{1}", endpoint, flavorId), this.simulator.Uri.ToString());
            Assert.AreEqual(HttpMethod.Get, this.simulator.Method);
        }
Example #3
0
        public async Task CanGetFlavor()
        {
            var flavorId = "1";

            this.simulator.Flavors.Add(new ComputeFlavor(flavorId, "tiny", "4", "2", "10", new Uri("http://testcomputeendpoint.com/v2/1234567890/flavors/1"), new Uri("http://testcomputeendpoint.com/1234567890/flavors/1"), new Dictionary <string, string>()));

            var client =
                new ComputeServiceRestClient(GetValidContext(), this.ServiceLocator);

            var resp = await client.GetFlavor(flavorId);

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

            var respContent = TestHelper.GetStringFromStream(resp.Content);

            Assert.IsTrue(respContent.Length > 0);
        }