SOLR-12514: Adding a positive testcase also

This commit is contained in:
noble 2019-01-04 14:50:52 +11:00
parent 63dfba4c7d
commit 663fa0e17f
1 changed files with 7 additions and 2 deletions

View File

@ -245,8 +245,13 @@ public class BasicAuthIntegrationTest extends SolrCloudAuthTestCase {
JettySolrRunner aNewJetty = cluster.startJettySolrRunner();
SolrClient aNewClient = aNewJetty.newClient();
try {
del = new UpdateRequest().deleteByQuery("*:*");
del.process(aNewClient, COLLECTION);
UpdateRequest delQuery = null;
delQuery = new UpdateRequest().deleteByQuery("*:*");
del.setBasicAuthCredentials("harry","HarryIsUberCool");
delQuery.process(aNewClient, COLLECTION);//this should succeed
delQuery = new UpdateRequest().deleteByQuery("*:*");
delQuery.process(aNewClient, COLLECTION);
fail("This should not have succeeded without credentials");
} catch (HttpSolrClient.RemoteSolrException e) {
assertTrue(e.getMessage().contains("Unauthorized request"));