public async Task CreateFloatinIpFormCorrectBody() { var client = new NetworkServiceRestClient(GetValidContext(), this.ServiceLocator); var resp = await client.CreateFloatingIp("12345"); Assert.AreEqual(HttpStatusCode.Created, resp.StatusCode); this.simulator.Content.Position = 0; var body = TestHelper.GetStringFromStream(this.simulator.Content); var ipObj = JObject.Parse(body); Assert.IsNotNull(ipObj); Assert.IsNotNull(ipObj["floatingip"]); Assert.IsNotNull(ipObj["floatingip"]["floating_network_id"]); Assert.AreEqual("12345", (string)ipObj["floatingip"]["floating_network_id"]); }
public async Task CreateFloatingIpFormsCorrectUrlAndMethod() { var client = new NetworkServiceRestClient(GetValidContext(), this.ServiceLocator); await client.CreateFloatingIp("12345"); Assert.AreEqual(string.Format("{0}/floatingips", endpoint + "v2.0"), this.simulator.Uri.ToString()); Assert.AreEqual(HttpMethod.Post, this.simulator.Method); }
public async Task CanCreateFloatinIp() { var client = new NetworkServiceRestClient(GetValidContext(), this.ServiceLocator); var resp = await client.CreateFloatingIp("12345"); Assert.AreEqual(HttpStatusCode.Created, resp.StatusCode); var respContent = TestHelper.GetStringFromStream(resp.Content); Assert.IsTrue(respContent.Length > 0); }
public async Task CreateFloatingIpIncludesAuthHeader() { var client = new NetworkServiceRestClient(GetValidContext(), this.ServiceLocator); await client.CreateFloatingIp("12345"); Assert.IsTrue(this.simulator.Headers.ContainsKey("X-Auth-Token")); Assert.AreEqual(this.authId, this.simulator.Headers["X-Auth-Token"]); }