@Test public void testNextFetchReturnsNull() throws Exception { serviceProvider.setReturnNull(true); MakeRequestClient client = makeNonSocialClient("owner", "owner", GADGET_URL); HttpResponse response = client.sendGet(FakeOAuthServiceProvider.ACCESS_TOKEN_URL); assertEquals("MISSING_SERVER_RESPONSE", response.getMetadata().get("oauthError")); assertEquals("", response.getResponseAsString()); String oauthErrorText = response.getMetadata().get("oauthErrorText"); checkStringContains("should say no response", oauthErrorText, "No response from server"); checkStringContains("should show request", oauthErrorText, "GET /request?param=foo&opensocial_owner_id=owner"); checkStringContains("should log empty response", oauthErrorText, "Received response 1:\n\n"); checkLogContains("No response from server"); checkLogContains("GET /request?param=foo&opensocial_owner_id=owner"); checkLogContains("OAuth error [MISSING_SERVER_RESPONSE, No response from server] for " + "application http://www.example.com/gadget.xml"); }
@Test public void testNextFetchReturnsNull() throws Exception { serviceProvider.setReturnNull(true); MakeRequestClient client = makeNonSocialClient("owner", "owner", GADGET_URL); HttpResponse response = client.sendGet(FakeOAuthServiceProvider.ACCESS_TOKEN_URL); assertEquals("MISSING_SERVER_RESPONSE", response.getMetadata().get("oauthError")); assertEquals("", response.getResponseAsString()); String oauthErrorText = response.getMetadata().get("oauthErrorText"); checkStringContains("should say no response", oauthErrorText, "No response from server"); checkStringContains("should show request", oauthErrorText, "GET /request?param=foo&opensocial_owner_id=owner"); checkStringContains("should log empty response", oauthErrorText, "Received response 1:\n\n"); checkLogContains("No response from server"); checkLogContains("GET /request?param=foo&opensocial_owner_id=owner"); checkLogContains("OAuth error [MISSING_SERVER_RESPONSE, No response from server] for " + "application http://www.example.com/gadget.xml"); }
@Test public void testNextFetchReturnsNull() throws Exception { serviceProvider.setReturnNull(true); MakeRequestClient client = makeNonSocialClient("owner", "owner", GADGET_URL); HttpResponse response = client.sendGet(FakeOAuthServiceProvider.ACCESS_TOKEN_URL); assertEquals("MISSING_SERVER_RESPONSE", response.getMetadata().get("oauthError")); assertEquals("", response.getResponseAsString()); String oauthErrorText = response.getMetadata().get("oauthErrorText"); checkStringContains("should say no response", oauthErrorText, "No response from server"); checkStringContains("should show request", oauthErrorText, "GET /request?param=foo&opensocial_owner_id=owner"); checkStringContains("should log empty response", oauthErrorText, "Received response 1:\n\n"); checkLogContains("No response from server"); checkLogContains("GET /request?param=foo&opensocial_owner_id=owner"); checkLogContains("OAuth error [MISSING_SERVER_RESPONSE, No response from server] for " + "application http://www.example.com/gadget.xml"); }