1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package org.xwiki.administration.test.ui; |
22 |
|
|
23 |
|
import static org.junit.Assert.assertTrue; |
24 |
|
|
25 |
|
import org.junit.Rule; |
26 |
|
import org.junit.Test; |
27 |
|
import org.xwiki.administration.test.po.GroupEditPage; |
28 |
|
import org.xwiki.administration.test.po.GroupsPage; |
29 |
|
import org.xwiki.model.reference.DocumentReference; |
30 |
|
import org.xwiki.test.ui.AbstractTest; |
31 |
|
import org.xwiki.test.ui.SuperAdminAuthenticationRule; |
32 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (17) |
Complexity: 1 |
Complexity Density: 0.06 |
|
33 |
|
public class GroupTest extends AbstractTest |
34 |
|
{ |
35 |
|
private static final String TESTER = "tester"; |
36 |
|
|
37 |
|
private static final String SUB_GROUP = "subGroup"; |
38 |
|
|
39 |
|
private static final String BIG_GROUP = "bigGroup"; |
40 |
|
|
41 |
|
@Rule |
42 |
|
public SuperAdminAuthenticationRule authenticationRule = new SuperAdminAuthenticationRule(getUtil()); |
43 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
44 |
1 |
@Test... |
45 |
|
public void addUserAndSubgroupToGroup() throws Exception |
46 |
|
{ |
47 |
|
|
48 |
1 |
getUtil().rest().deletePage("XWiki", BIG_GROUP); |
49 |
1 |
getUtil().rest().deletePage("XWiki", SUB_GROUP); |
50 |
1 |
getUtil().rest().deletePage("XWiki", TESTER); |
51 |
|
|
52 |
|
|
53 |
1 |
getUtil().createUser(TESTER, TESTER, "", "first_name", "", "last_name", ""); |
54 |
1 |
GroupsPage groupsPage = GroupsPage.gotoPage(); |
55 |
1 |
groupsPage.addNewGroup(SUB_GROUP); |
56 |
1 |
groupsPage.addNewGroup(BIG_GROUP); |
57 |
|
|
58 |
|
|
59 |
1 |
assertTrue("bigGroup doesn't exist!", groupsPage.getGroupsTable().hasRow("Group Name", BIG_GROUP)); |
60 |
1 |
assertTrue("subGroup doesn't exist!", groupsPage.getGroupsTable().hasRow("Group Name", SUB_GROUP)); |
61 |
|
|
62 |
|
|
63 |
1 |
GroupEditPage bigGroupPage = GroupEditPage.gotoPage(new DocumentReference("xwiki", "XWiki", BIG_GROUP)); |
64 |
1 |
bigGroupPage.addMemberToGroup(SUB_GROUP, false); |
65 |
1 |
bigGroupPage.addMemberToGroup(TESTER, true); |
66 |
|
|
67 |
|
|
68 |
1 |
bigGroupPage.filterMembers(SUB_GROUP); |
69 |
1 |
assertTrue("subGroup is not part of bigGroup!", |
70 |
|
bigGroupPage.getMembersTable().hasRow("Member", String.format("%s (XWiki.%s)", SUB_GROUP, SUB_GROUP))); |
71 |
|
|
72 |
|
|
73 |
1 |
bigGroupPage.filterMembers(TESTER); |
74 |
1 |
assertTrue("tester is not part of bigGroup!", |
75 |
|
bigGroupPage.getMembersTable().hasRow("Member", String.format("%s (XWiki.%s)", TESTER, TESTER))); |
76 |
|
} |
77 |
|
} |