+
+ @Test
+ public void testAffiliationRights() throws IOException, GigiApiException {
+ User u2 = User.getById(createAssuranceUser("testworker", "testname", createUniqueName() + "@testdom.com", TEST_PASSWORD));
+ User u3 = User.getById(createAssuranceUser("testmaster", "testname", createUniqueName() + "@testdom.com", TEST_PASSWORD));
+ User u4_dummy = User.getById(createVerifiedUser("testmaster", "testname", createUniqueName() + "@testdom.com", TEST_PASSWORD));
+ Organisation o1 = new Organisation("name21", "DE", "sder", "Rostov", "email", u);
+ o1.addAdmin(u3, u, true);
+ try {
+ // must fail because u4 is no assurer
+ o1.addAdmin(u4_dummy, u3, false);
+ fail("No exception!");
+ } catch (GigiApiException e) {
+ }
+ o1.addAdmin(u2, u3, false);
+ try {
+ // must fail because u2 may not add admins
+ o1.addAdmin(u3, u2, false);
+ fail("No exception!");
+ } catch (GigiApiException e) {
+ }
+ try {
+ // must fail because u4 is no assurer
+ o1.addAdmin(u4_dummy, u, false);
+ fail("No exception!");
+ } catch (GigiApiException e) {
+ }
+ o1.removeAdmin(u2, u3);
+ o1.removeAdmin(u3, u3);
+ assertEquals(0, o1.getAllAdmins().size());
+ o1.delete();
+ }