more tests (test domain, role)
This commit is contained in:
parent
2bb1049e6a
commit
3e65b6406b
@ -18,6 +18,7 @@ public class InitDataTest {
|
|||||||
private static final String CUST_MODULE = "member";
|
private static final String CUST_MODULE = "member";
|
||||||
private static final String PAC_MODULE = "pac";
|
private static final String PAC_MODULE = "pac";
|
||||||
private static final String USER_MODULE = "user";
|
private static final String USER_MODULE = "user";
|
||||||
|
private static final String DOM_MODULE = "domain";
|
||||||
|
|
||||||
private XmlRpcClient client;
|
private XmlRpcClient client;
|
||||||
private RemoteCASHelper cas;
|
private RemoteCASHelper cas;
|
||||||
@ -122,6 +123,50 @@ public class InitDataTest {
|
|||||||
assertEquals(count + 1, getUsersCount());
|
assertEquals(count + 1, getUsersCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAddDomain() {
|
||||||
|
int count = getUsersCount();
|
||||||
|
try {
|
||||||
|
String user = "aaa00";
|
||||||
|
String grantingTicketURL = cas.getGrantingTicketURL(user);
|
||||||
|
Map<String, String> setParams = new HashMap<String, String>();
|
||||||
|
setParams.put("name", "aaa00-admin");
|
||||||
|
setParams.put("password", "test123");
|
||||||
|
setParams.put("quota", "128");
|
||||||
|
setParams.put("quotalimit", "192");
|
||||||
|
Object[] params = new Object[] { user,
|
||||||
|
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
|
||||||
|
setParams };
|
||||||
|
Object execute = client.execute(USER_MODULE + ".add", params);
|
||||||
|
if (execute instanceof Map<?, ?>) {
|
||||||
|
Map<?, ?> entry = (Map<?, ?>) execute;
|
||||||
|
assertEquals("aaa00-test2", entry.get("name"));
|
||||||
|
assertEquals("aaa00", entry.get("pac"));
|
||||||
|
assertEquals(null, entry.get("password"));
|
||||||
|
} else {
|
||||||
|
fail("map expected");
|
||||||
|
}
|
||||||
|
grantingTicketURL = cas.getGrantingTicketURL(user);
|
||||||
|
setParams = new HashMap<String, String>();
|
||||||
|
setParams.put("user", "aaa00-admin");
|
||||||
|
setParams.put("name", "example01.org");
|
||||||
|
params = new Object[] { user,
|
||||||
|
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
|
||||||
|
setParams };
|
||||||
|
execute = client.execute(DOM_MODULE + ".add", params);
|
||||||
|
if (execute instanceof Map<?, ?>) {
|
||||||
|
Map<?, ?> entry = (Map<?, ?>) execute;
|
||||||
|
assertEquals("example01.org", entry.get("name"));
|
||||||
|
assertEquals("aaa00", entry.get("pac"));
|
||||||
|
} else {
|
||||||
|
fail("map expected");
|
||||||
|
}
|
||||||
|
} catch (XmlRpcException e) {
|
||||||
|
fail(e.getMessage());
|
||||||
|
}
|
||||||
|
assertEquals(count + 1, getUsersCount());
|
||||||
|
}
|
||||||
|
|
||||||
// @Test
|
// @Test
|
||||||
public void testDelPac() {
|
public void testDelPac() {
|
||||||
int count = getPacsCount();
|
int count = getPacsCount();
|
||||||
|
@ -45,7 +45,7 @@ public class RoleTest {
|
|||||||
Object[] result = (Object[]) execute;
|
Object[] result = (Object[]) execute;
|
||||||
assertTrue(result.length == 1);
|
assertTrue(result.length == 1);
|
||||||
String role = (String) ((Map<?, ?>) result[0]).get("role");
|
String role = (String) ((Map<?, ?>) result[0]).get("role");
|
||||||
assertEquals("PAC_ADMIN", role);
|
assertEquals("PAC_ADMIN_DW", role);
|
||||||
} catch (XmlRpcException e) {
|
} catch (XmlRpcException e) {
|
||||||
fail(e.getMessage());
|
fail(e.getMessage());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user