Package com.squareup.okhttp.mockwebserver

Examples of com.squareup.okhttp.mockwebserver.MockResponse


      TemporaryUrlSigner.checkApiEvery(null, 10000);
   }

   public void whenAccountApiHasKey() throws Exception {
      MockWebServer server = mockOpenStackServer();
      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
      server.enqueue(addCommonHeaders(accountResponse().addHeader("X-Account-Meta-Temp-URL-Key", "mykey")));

      try {
         SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
         String signature = TemporaryUrlSigner.checkApiEvery(api.accountApiInRegion("DFW"), 10000)
View Full Code Here


   }

   @Test(expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = ".*returned a null temporaryUrlKey!")
   public void whenAccountApiDoesntHaveKey() throws Exception {
      MockWebServer server = mockOpenStackServer();
      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
      server.enqueue(addCommonHeaders(accountResponse()));

      try {
         SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
         TemporaryUrlSigner.checkApiEvery(api.accountApiInRegion("DFW"), 10000)
View Full Code Here

@Test
public class StaticLargeObjectApiMockTest extends BaseOpenStackMockTest<SwiftApi> {

   public void replaceManifest() throws Exception {
      MockWebServer server = mockOpenStackServer();
      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
      server.enqueue(addCommonHeaders(new MockResponse().addHeader(HttpHeaders.ETAG, "\"abcd\"")));

      try {
         SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
         assertEquals(
               api.staticLargeObjectApiInRegionForContainer("DFW", "myContainer").replaceManifest(
View Full Code Here

      }
   }

   public void delete() throws Exception {
      MockWebServer server = mockOpenStackServer();
      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
      server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(204)));

      try {
         SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
         api.staticLargeObjectApiInRegionForContainer("DFW", "myContainer").delete("myObject");
View Full Code Here

      }
   }

   public void alreadyDeleted() throws Exception {
      MockWebServer server = mockOpenStackServer();
      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
      server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(404)));

      try {
         SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
         api.staticLargeObjectApiInRegionForContainer("DFW", "myContainer").delete("myObject");
View Full Code Here

@Test(groups = "unit", testName = "EventApiMockTest")
public class EventApiMockTest extends BaseDigitalOceanMockTest {

   public void testGetEvent() throws Exception {
      MockWebServer server = mockWebServer();
      server.enqueue(new MockResponse().setBody(payloadFromResource("/event.json")));

      DigitalOceanApi api = api(server.getUrl("/"));
      EventApi eventApi = api.getEventApi();

      try {
View Full Code Here

      }
   }

   public void testGetPendingEvent() throws Exception {
      MockWebServer server = mockWebServer();
      server.enqueue(new MockResponse().setBody(payloadFromResource("/event-pending.json")));

      DigitalOceanApi api = api(server.getUrl("/"));
      EventApi eventApi = api.getEventApi();

      try {
View Full Code Here

      }
   }

   public void testGetUnexistingEvent() throws Exception {
      MockWebServer server = mockWebServer();
      server.enqueue(new MockResponse().setResponseCode(404));

      DigitalOceanApi api = api(server.getUrl("/"));
      EventApi eventApi = api.getEventApi();

      try {
View Full Code Here

      }
   }

   public void testCreateDropletWithOptions() throws Exception {
      MockWebServer server = mockWebServer();
      server.enqueue(new MockResponse().setBody(payloadFromResource("/droplet-creation.json")));

      DigitalOceanApi api = api(server.getUrl("/"));
      DropletApi dropletApi = api.getDropletApi();

      try {
View Full Code Here

      }
   }

   public void testRebootDroplet() throws Exception {
      MockWebServer server = mockWebServer();
      server.enqueue(new MockResponse().setBody(payloadFromResource("/eventid.json")));

      DigitalOceanApi api = api(server.getUrl("/"));
      DropletApi dropletApi = api.getDropletApi();

      try {
View Full Code Here

TOP

Related Classes of com.squareup.okhttp.mockwebserver.MockResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.