use of org.ligoj.app.model.DelegateNode in project ligoj-api by ligoj.
the class DelegateNodeResourceTest method createSubNode.
@Test
public void createSubNode() {
initSpringSecurityContext("user1");
final DelegateNode delegate = new DelegateNode();
delegate.setNode("service:build:jenkins:dig");
delegate.setReceiver("user1");
Assertions.assertTrue(resource.create(delegate) > 0);
}
use of org.ligoj.app.model.DelegateNode in project ligoj-api by ligoj.
the class DelegateNodeResourceTest method updateNoChange.
@Test
public void updateNoChange() {
// Add a special right on for a node
final DelegateNode delegate = new DelegateNode();
delegate.setNode("service:build:jenkins");
delegate.setReceiver("user2");
delegate.setCanAdmin(true);
repository.saveAndFlush(delegate);
initSpringSecurityContext("user2");
final DelegateNode newDelegate = new DelegateNode();
newDelegate.setNode("service:build:jenkins");
newDelegate.setReceiver("user2");
newDelegate.setCanAdmin(true);
resource.update(newDelegate);
}
use of org.ligoj.app.model.DelegateNode in project ligoj-api by ligoj.
the class DelegateNodeResourceTest method createWriteNotAdmin.
@Test
public void createWriteNotAdmin() {
// Add a special right on for a node
final DelegateNode delegate = new DelegateNode();
delegate.setNode("service:build:jenkins");
delegate.setReceiver("user2");
delegate.setCanWrite(true);
repository.saveAndFlush(delegate);
initSpringSecurityContext("user2");
final DelegateNode newDelegate = new DelegateNode();
newDelegate.setNode("service:build:jenkins:dig");
newDelegate.setReceiver("user2");
Assertions.assertThrows(NotFoundException.class, () -> {
resource.create(newDelegate);
});
}
use of org.ligoj.app.model.DelegateNode in project ligoj-api by ligoj.
the class DelegateNodeResourceTest method createGrantRefused.
@Test
public void createGrantRefused() {
// Add a special right on for a node
final DelegateNode delegate = new DelegateNode();
delegate.setNode("service:build:jenkins");
delegate.setReceiver("user2");
delegate.setCanAdmin(true);
repository.saveAndFlush(delegate);
initSpringSecurityContext("user2");
final DelegateNode newDelegate = new DelegateNode();
newDelegate.setNode("service:build:jenkins:dig");
newDelegate.setReceiver("user2");
newDelegate.setCanWrite(true);
Assertions.assertThrows(javax.ws.rs.NotFoundException.class, () -> {
resource.create(newDelegate);
});
}
use of org.ligoj.app.model.DelegateNode in project ligoj-api by ligoj.
the class DelegateNodeResourceTest method updateSubNodeReduceRight.
@Test
public void updateSubNodeReduceRight() {
// Add a special right on for a node
final DelegateNode delegate = new DelegateNode();
delegate.setNode("service:build:jenkins");
delegate.setReceiver("user2");
delegate.setCanAdmin(true);
repository.saveAndFlush(delegate);
initSpringSecurityContext("user2");
final DelegateNode newDelegate = new DelegateNode();
newDelegate.setNode("service:build:jenkins");
newDelegate.setReceiver("user2");
resource.update(newDelegate);
}
Aggregations