use of org.xwiki.wiki.user.MemberCandidacy in project xwiki-platform by xwiki.
the class WikiUserManagerScriptServiceTest method getAllInvitationsError.
@Test
public void getAllInvitationsError() throws Exception {
// Mocks
Exception expectedException = new WikiUserManagerException("error in getAllInvitations()");
when(wikiUserManager.getAllInvitations("subwiki")).thenThrow(expectedException);
// Test
Collection<MemberCandidacy> result = mocker.getComponentUnderTest().getAllInvitations("subwiki");
// Asserts
assertNull(result);
assertEquals(expectedException, mocker.getComponentUnderTest().getLastError());
}
use of org.xwiki.wiki.user.MemberCandidacy in project xwiki-platform by xwiki.
the class WikiUserManagerScriptServiceTest method inviteWhenUserHasNoAdminRight.
@Test
public void inviteWhenUserHasNoAdminRight() throws Exception {
// Mocks
Exception expectedException = currentUserHasNotAdminRight();
// Test
MemberCandidacy result = mocker.getComponentUnderTest().invite("someUser", "subwiki", "someMessage");
// Asserts
assertNull(result);
assertEquals(expectedException, mocker.getComponentUnderTest().getLastError());
verifyZeroInteractions(wikiUserManager);
}
use of org.xwiki.wiki.user.MemberCandidacy in project xwiki-platform by xwiki.
the class WikiUserManagerScriptServiceTest method acceptInvitationWhenUserHasNoAdminRight.
@Test
public void acceptInvitationWhenUserHasNoAdminRight() throws Exception {
MemberCandidacy candidacy = new MemberCandidacy("subwiki", "mainWiki:XWiki.OtherUser", MemberCandidacy.CandidateType.INVITATION);
// Mocks
Exception exception = currentUserHasNotAdminRight();
// Test
Boolean result = mocker.getComponentUnderTest().acceptInvitation(candidacy, "thanks");
// Asserts
assertFalse(result);
assertEquals(exception, mocker.getComponentUnderTest().getLastError());
verifyZeroInteractions(wikiUserManager);
}
use of org.xwiki.wiki.user.MemberCandidacy in project xwiki-platform by xwiki.
the class WikiUserManagerScriptServiceTest method askToJoinWhenUserHasNoRightButConcerned.
@Test
public void askToJoinWhenUserHasNoRightButConcerned() throws Exception {
// Mocks
currentUserHasNotAdminRight();
MemberCandidacy candidacy = new MemberCandidacy();
when(wikiUserManager.askToJoin("mainWiki:XWiki.User", "subwiki", "please!")).thenReturn(candidacy);
// Test
MemberCandidacy result = mocker.getComponentUnderTest().askToJoin("mainWiki:XWiki.User", "subwiki", "please!");
// Asserts
assertEquals(candidacy, result);
assertNull(mocker.getComponentUnderTest().getLastError());
}
Aggregations