public async Task GetComputeImagesFormsCorrectUrlAndMethod() { var client = new ComputeServiceRestClient(GetValidContext(), this.ServiceLocator); await client.GetImages(); Assert.AreEqual(string.Format("{0}/images/detail", endpoint), this.simulator.Uri.ToString()); Assert.AreEqual(HttpMethod.Get, this.simulator.Method); }
public async Task CanGetImages() { var created = DateTime.UtcNow.Subtract(TimeSpan.FromMinutes(10)); var updated = DateTime.UtcNow.Subtract(TimeSpan.FromMinutes(1)); this.simulator.Images.Add(new ComputeImage("1", "tiny", new Uri("http://testcomputeendpoint.com/v2/1234567890/flavors/1"), new Uri("http://testcomputeendpoint.com/1234567890/flavors/1"), new Dictionary<string, string>(), "ACTIVE", created, updated, 10, 512, 100)); var client = new ComputeServiceRestClient(GetValidContext(), this.ServiceLocator); var resp = await client.GetImages(); Assert.AreEqual(HttpStatusCode.OK, resp.StatusCode); var respContent = TestHelper.GetStringFromStream(resp.Content); Assert.IsTrue(respContent.Length > 0); }
public async Task GetComputeImagesIncludesAuthHeader() { var client = new ComputeServiceRestClient(GetValidContext(), this.ServiceLocator); await client.GetImages(); Assert.IsTrue(this.simulator.Headers.ContainsKey("X-Auth-Token")); Assert.AreEqual(this.authId, this.simulator.Headers["X-Auth-Token"]); }