mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
Correct test implementation with Authentication Enable
This commit is contained in:
parent
21d91ef6bc
commit
0360108870
1 changed files with 6 additions and 7 deletions
|
|
@ -40,7 +40,7 @@ public class SecurityRestApiTest extends AbstractTestRestApi {
|
|||
|
||||
@BeforeClass
|
||||
public static void init() throws Exception {
|
||||
AbstractTestRestApi.startUpWithAuthenticationEnable();;
|
||||
AbstractTestRestApi.startUpWithAuthenticationEnable();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
|
|
@ -50,21 +50,21 @@ public class SecurityRestApiTest extends AbstractTestRestApi {
|
|||
|
||||
@Test
|
||||
public void testTicket() throws IOException {
|
||||
GetMethod get = httpGet("/security/ticket");
|
||||
GetMethod get = httpGet("/security/ticket", "admin", "password1");
|
||||
get.addRequestHeader("Origin", "http://localhost");
|
||||
Map<String, Object> resp = gson.fromJson(get.getResponseBodyAsString(),
|
||||
new TypeToken<Map<String, Object>>(){}.getType());
|
||||
Map<String, String> body = (Map<String, String>) resp.get("body");
|
||||
collector.checkThat("Paramater principal", body.get("principal"),
|
||||
CoreMatchers.equalTo("anonymous"));
|
||||
CoreMatchers.equalTo("admin"));
|
||||
collector.checkThat("Paramater ticket", body.get("ticket"),
|
||||
CoreMatchers.equalTo("anonymous"));
|
||||
CoreMatchers.not("anonymous"));
|
||||
get.releaseConnection();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetUserList() throws IOException {
|
||||
GetMethod get = httpGet("/security/userlist/admi");
|
||||
GetMethod get = httpGet("/security/userlist/admi", "admin", "password1");
|
||||
get.addRequestHeader("Origin", "http://localhost");
|
||||
Map<String, Object> resp = gson.fromJson(get.getResponseBodyAsString(),
|
||||
new TypeToken<Map<String, Object>>(){}.getType());
|
||||
|
|
@ -75,7 +75,7 @@ public class SecurityRestApiTest extends AbstractTestRestApi {
|
|||
CoreMatchers.equalTo(true));
|
||||
get.releaseConnection();
|
||||
|
||||
GetMethod notUser = httpGet("/security/userlist/randomString");
|
||||
GetMethod notUser = httpGet("/security/userlist/randomString", "admin", "password1");
|
||||
notUser.addRequestHeader("Origin", "http://localhost");
|
||||
Map<String, Object> notUserResp = gson.fromJson(notUser.getResponseBodyAsString(),
|
||||
new TypeToken<Map<String, Object>>(){}.getType());
|
||||
|
|
@ -85,6 +85,5 @@ public class SecurityRestApiTest extends AbstractTestRestApi {
|
|||
|
||||
notUser.releaseConnection();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue