Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OF-241 + OF-747 Test preparation for MUC privileges.
- Loading branch information
Showing
2 changed files
with
105 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/test/java/org/jivesoftware/openfire/muc/spi/MucPrivilegesTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package org.jivesoftware.openfire.muc.spi; | ||
|
||
import junit.framework.Assert; | ||
import org.jivesoftware.openfire.muc.MUCRole; | ||
import org.junit.Test; | ||
|
||
/** | ||
* @author Christian Schudt | ||
*/ | ||
public class MucPrivilegesTest { | ||
|
||
@Test | ||
public void ownerShouldBeAbleToDoAnything() { | ||
Assert.assertTrue(LocalMUCRoom.isPrivilegedToChangeAffiliationAndRole(MUCRole.Affiliation.owner, MUCRole.Role.moderator, MUCRole.Affiliation.owner, MUCRole.Role.moderator, MUCRole.Affiliation.none, MUCRole.Role.none)); | ||
} | ||
|
||
@Test | ||
public void adminShouldBeAbleToRevokeModeratorPrivilegesFromOtherAdmin() { | ||
Assert.assertTrue(LocalMUCRoom.isPrivilegedToChangeAffiliationAndRole(MUCRole.Affiliation.admin, MUCRole.Role.none, MUCRole.Affiliation.admin, MUCRole.Role.moderator, MUCRole.Affiliation.admin, MUCRole.Role.none)); | ||
} | ||
|
||
@Test | ||
public void adminShouldBeAbleToGrantMembership() { | ||
Assert.assertTrue(LocalMUCRoom.isPrivilegedToChangeAffiliationAndRole(MUCRole.Affiliation.admin, MUCRole.Role.none, MUCRole.Affiliation.none, MUCRole.Role.none, MUCRole.Affiliation.member, MUCRole.Role.participant)); | ||
} | ||
|
||
@Test | ||
public void adminModeratorShouldNotBeAbleToRevokeModeratorPrivilegesFromOwner() { | ||
Assert.assertFalse(LocalMUCRoom.isPrivilegedToChangeAffiliationAndRole(MUCRole.Affiliation.admin, MUCRole.Role.moderator, MUCRole.Affiliation.owner, MUCRole.Role.moderator, MUCRole.Affiliation.none, MUCRole.Role.none)); | ||
} | ||
|
||
@Test | ||
public void ownerModeratorShouldBeAbleToRevokeModeratorPrivilegesFromOwner() { | ||
Assert.assertTrue(LocalMUCRoom.isPrivilegedToChangeAffiliationAndRole(MUCRole.Affiliation.owner, MUCRole.Role.moderator, MUCRole.Affiliation.owner, MUCRole.Role.moderator, MUCRole.Affiliation.none, MUCRole.Role.none)); | ||
} | ||
|
||
@Test | ||
public void ownerModeratorShouldBeAbleToRevokeModeratorPrivilegesFromAdmin() { | ||
Assert.assertTrue(LocalMUCRoom.isPrivilegedToChangeAffiliationAndRole(MUCRole.Affiliation.owner, MUCRole.Role.moderator, MUCRole.Affiliation.admin, MUCRole.Role.moderator, MUCRole.Affiliation.none, MUCRole.Role.none)); | ||
} | ||
|
||
@Test | ||
public void memberModeratorShouldNotBeAbleToRevokeModeratorPrivilegesFromOwner() { | ||
Assert.assertFalse(LocalMUCRoom.isPrivilegedToChangeAffiliationAndRole(MUCRole.Affiliation.member, MUCRole.Role.moderator, MUCRole.Affiliation.owner, MUCRole.Role.moderator, MUCRole.Affiliation.none, MUCRole.Role.none)); | ||
} | ||
|
||
@Test | ||
public void memberModeratorShouldNotBeAbleToRevokeModeratorPrivilegesFromAdmin() { | ||
Assert.assertFalse(LocalMUCRoom.isPrivilegedToChangeAffiliationAndRole(MUCRole.Affiliation.member, MUCRole.Role.moderator, MUCRole.Affiliation.admin, MUCRole.Role.moderator, MUCRole.Affiliation.none, MUCRole.Role.none)); | ||
} | ||
|
||
@Test | ||
public void memberShouldNotBeAbleToDoAnything() { | ||
Assert.assertFalse(LocalMUCRoom.isPrivilegedToChangeAffiliationAndRole(MUCRole.Affiliation.member, MUCRole.Role.participant, MUCRole.Affiliation.admin, MUCRole.Role.moderator, MUCRole.Affiliation.none, MUCRole.Role.none)); | ||
} | ||
} |