public async Task DeleteComputeImageFormsCorrectUrlAndMethod() { var imageId = "12345"; var client = new ComputeServiceRestClient(GetValidContext(), this.ServiceLocator); await client.DeleteImage(imageId); Assert.AreEqual(string.Format("{0}/images/{1}", endpoint, imageId), this.simulator.Uri.ToString()); Assert.AreEqual(HttpMethod.Delete, this.simulator.Method); }
public async Task CanDeleteImage() { var imageId = "12345"; var created = DateTime.UtcNow.Subtract(TimeSpan.FromMinutes(10)); var updated = DateTime.UtcNow.Subtract(TimeSpan.FromMinutes(1)); this.simulator.Images.Add(new ComputeImage(imageId, "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.DeleteImage(imageId); Assert.AreEqual(HttpStatusCode.OK, resp.StatusCode); Assert.IsFalse(this.simulator.Images.Any()); }
public async Task DeleteComputeImageIncludesAuthHeader() { var client = new ComputeServiceRestClient(GetValidContext(), this.ServiceLocator); await client.DeleteImage("12345"); Assert.IsTrue(this.simulator.Headers.ContainsKey("X-Auth-Token")); Assert.AreEqual(this.authId, this.simulator.Headers["X-Auth-Token"]); }