use of edu.hawaii.its.groupings.controller.WithMockUhUser in project uhgroupings by uhawaii-system-its-ti-iam.
the class TestGroupingsRestController method adminListsPassTest.
@Test
@WithMockUhUser(username = "_groupings_api_2")
public void adminListsPassTest() throws Exception {
AdminListsHolder infoSuccess = mapAdminListsHolder();
// STUDENT_TEST_USERNAME can be replaced with any account that has admin access
assertTrue(infoSuccess.getAdminGroup().getUsernames().contains(STUDENT_TEST_USERNAME));
}
use of edu.hawaii.its.groupings.controller.WithMockUhUser in project uhgroupings by uhawaii-system-its-ti-iam.
the class TestGroupingsRestController method assignAndRemoveOwnershipTest.
@Test
@WithMockUhUser(username = "iamtst01")
public void assignAndRemoveOwnershipTest() throws Exception {
Grouping g = mapGrouping(GROUPING);
assertFalse(g.getOwners().getUsernames().contains(tst[1]));
mapGSR("/api/groupings/" + GROUPING + "/" + tst[1] + "/assignOwnership");
g = mapGrouping(GROUPING);
assertTrue(g.getOwners().getUsernames().contains(tst[1]));
mapGSR("/api/groupings/" + GROUPING + "/" + tst[1] + "/removeOwnership");
g = mapGrouping(GROUPING);
assertFalse(g.getOwners().getUsernames().contains(tst[1]));
}
use of edu.hawaii.its.groupings.controller.WithMockUhUser in project uhgroupings by uhawaii-system-its-ti-iam.
the class TestGroupingsRestController method myGroupingsTest3.
@Test
@WithMockUhUser(username = "iamtst04")
public void myGroupingsTest3() throws Exception {
boolean optedIn = false;
GroupingAssignment tst4Groupings = mapGroupingAssignment();
assertEquals(tst4Groupings.getGroupingsOptedInTo().size(), 0);
mapGSRs("/api/groupings/" + GROUPING + "/optIn");
tst4Groupings = mapGroupingAssignment();
for (Grouping grouping : tst4Groupings.getGroupingsOptedInTo()) {
if (grouping.getPath().contains(GROUPING)) {
optedIn = true;
}
}
// in basis
assertFalse(optedIn);
}
use of edu.hawaii.its.groupings.controller.WithMockUhUser in project uhgroupings by uhawaii-system-its-ti-iam.
the class TestGroupingsRestController method myGroupingsTest2.
@Test
@WithMockUhUser(username = "iamtst04")
public void myGroupingsTest2() throws Exception {
GroupingAssignment groupings = mapGroupingAssignment();
boolean inGrouping = false;
for (Grouping grouping : groupings.getGroupingsIn()) {
if (grouping.getPath().contains(this.GROUPING)) {
inGrouping = true;
break;
}
}
assertFalse(inGrouping);
boolean ownsGrouping = false;
for (Grouping grouping : groupings.getGroupingsOwned()) {
if (grouping.getPath().contains(this.GROUPING)) {
ownsGrouping = true;
break;
}
}
assertFalse(ownsGrouping);
}
use of edu.hawaii.its.groupings.controller.WithMockUhUser in project uhgroupings by uhawaii-system-its-ti-iam.
the class TestGroupingsRestController method aaronTest.
@Test
@WithMockUhUser(username = "aaronvil")
public void aaronTest() throws Exception {
// This test often fails because the test server is very slow.
// Because the server caches some results and gets quicker the more times
// it is run, we let it run a few times if it starts failing
int i = 0;
while (i < 5) {
try {
GroupingAssignment aaronsGroupings = mapGroupingAssignment();
assertNotNull(aaronsGroupings);
break;
} catch (AssertionError ae) {
i++;
}
}
assertTrue(i < 5);
}
Aggregations