[Test] add response to the fail statement for debugging

Original commit: elastic/x-pack-elasticsearch@c6628a5cda
This commit is contained in:
jaymode 2015-06-06 15:48:14 -04:00
parent 1c54d49a71
commit 26f52be95a
1 changed files with 4 additions and 4 deletions

View File

@ -91,7 +91,7 @@ public class ShieldCachePermissionTests extends ShieldIntegrationTest {
// Repeat with unauthorized user!!!!
try {
client().prepareSearch("data").setTypes("a").setQuery(QueryBuilders.filteredQuery(
response = client().prepareSearch("data").setTypes("a").setQuery(QueryBuilders.filteredQuery(
QueryBuilders.matchAllQuery(),
QueryBuilders.termsLookupQuery("token")
.lookupIndex("tokens")
@ -100,7 +100,7 @@ public class ShieldCachePermissionTests extends ShieldIntegrationTest {
.lookupPath("tokens")))
.putHeader("Authorization", basicAuthHeaderValue(READ_ONE_IDX_USER, new SecuredString("changeme".toCharArray())))
.execute().actionGet();
fail("search phase exception should have been thrown");
fail("search phase exception should have been thrown! response was:\n" + response.toString());
} catch (SearchPhaseExecutionException e) {
assertThat(e.toString(), containsString("AuthorizationException"));
}
@ -118,13 +118,13 @@ public class ShieldCachePermissionTests extends ShieldIntegrationTest {
// Repeat with unauthorized user!!!!
try {
client().prepareSearch("data").setTypes("a")
response = client().prepareSearch("data").setTypes("a")
.setTemplateType(ScriptService.ScriptType.INDEXED)
.setTemplateName("testTemplate")
.setTemplateParams(Collections.<String, Object>singletonMap("name", "token"))
.putHeader("Authorization", basicAuthHeaderValue(READ_ONE_IDX_USER, new SecuredString("changeme".toCharArray())))
.execute().actionGet();
fail("search phase exception should have been thrown");
fail("search phase exception should have been thrown! response was:\n" + response.toString());
} catch (SearchPhaseExecutionException e) {
assertThat(e.toString(), containsString("AuthorizationException"));
}