@Test
public void testPostRoleCertificateRequest() {

    // this csr is for sports:role.readers role
    long expiry = 3600;
    RoleCertificateRequest req = new RoleCertificateRequest()
            .setCsr(ROLE_CERT_CORETECH_REQUEST).setExpiryTime(expiry);
    
    SignedDomain signedDomain = createSignedDomain("coretech", "weather", "storage", true);
    store.processDomain(signedDomain, false);
    CloudStore cloudStore = new MockCloudStore();
    store.setCloudStore(cloudStore);
    zts.cloudStore = cloudStore;
    
    Principal principal = SimplePrincipal.create("user_domain", "user1",
            "v=U1;d=user_domain;n=user;s=signature", 0, null);
    ResourceContext context = createResourceContext(principal);
    RoleToken roleToken = zts.postRoleCertificateRequest(context, "coretech",
            "readers", req);
    assertNotNull(roleToken);
    // allow 10 sec offset (output is in seconds while input was in minutes)
    long diffExpiryTime = roleToken.getExpiryTime() - System.currentTimeMillis() / 1000;
    assertTrue(Math.abs(diffExpiryTime - expiry * 60) < 10);
}