use of retrofit2.Response in project keywhiz by square.
the class XsrfServletFilterIntegrationTest method rejectsForAdminUrlWithoutXsrf.
@Test
public void rejectsForAdminUrlWithoutXsrf() throws Exception {
noXsrfClient.newCall(buildLoginPost(DbSeedCommand.defaultUser, DbSeedCommand.defaultPassword)).execute();
Request request = new Request.Builder().url(testUrl("/admin/clients")).get().build();
Response response = noXsrfClient.newCall(request).execute();
assertThat(response.code()).isEqualTo(401);
}
use of retrofit2.Response in project keywhiz by square.
the class XsrfServletFilterIntegrationTest method xsrfNotRequiredForLogout.
@Test
public void xsrfNotRequiredForLogout() throws Exception {
Request request = new Request.Builder().post(RequestBody.create(MediaType.parse("text/plain"), "")).url(testUrl("/admin/logout")).build();
Response response = client.newCall(request).execute();
assertThat(response.code()).isNotEqualTo(401);
}
use of retrofit2.Response in project keywhiz by square.
the class XsrfServletFilterIntegrationTest method allowsForAdminUrlWithXsrf.
@Test
public void allowsForAdminUrlWithXsrf() throws Exception {
client.newCall(buildLoginPost(DbSeedCommand.defaultUser, DbSeedCommand.defaultPassword)).execute();
Request request = new Request.Builder().url(testUrl("/admin/clients")).get().build();
Response response = client.newCall(request).execute();
assertThat(response.code()).isNotEqualTo(401);
}
use of retrofit2.Response in project keywhiz by square.
the class SessionLoginResourceIntegrationTest method noFormDataIsBadRequest.
@Test
public void noFormDataIsBadRequest() throws Exception {
Request request = buildLoginPost(null, null);
Response response = client.newCall(request).execute();
assertThat(response.code()).isEqualTo(400);
}
use of retrofit2.Response in project keywhiz by square.
the class AutomationSecretAccessResourceIntegrationTest method allowAccess.
@Test
public void allowAccess() throws Exception {
//Allow "Web" to access "Hacking_Password"
Request put = new Request.Builder().put(RequestBody.create(MediaType.parse("text/plain"), "")).url(testUrl("/automation/secrets/738/groups/918")).build();
Response response = mutualSslClient.newCall(put).execute();
assertThat(response.code()).isEqualTo(200);
}
Aggregations