Skip to content

Commit

Permalink
Improved tests to reproduce MID-4931
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Nov 12, 2018
1 parent 871c097 commit 27ab373
Showing 1 changed file with 14 additions and 1 deletion.
Expand Up @@ -1193,20 +1193,33 @@ public void test340AutzJackSuperUserAndExecRead() throws Exception {

assignRole(USER_JACK_OID, ROLE_SUPERUSER_OID);
assignRole(USER_JACK_OID, ROLE_READ_ORG_EXEC_OID);


// preconditions
assertSearch(UserType.class, createOrgSubtreeQuery(ORG_MINISTRY_OF_OFFENSE_OID), USER_LECHUCK_OID, USER_GUYBRUSH_OID, userCobbOid, USER_ESTEVAN_OID);
assertSearch(UserType.class, createOrgSubtreeAndNameQuery(ORG_MINISTRY_OF_OFFENSE_OID, USER_GUYBRUSH_USERNAME), USER_GUYBRUSH_OID);
assertSearch(ObjectType.class, createOrgSubtreeAndNameQuery(ORG_MINISTRY_OF_OFFENSE_OID, USER_GUYBRUSH_USERNAME), USER_GUYBRUSH_OID);

login(USER_JACK_USERNAME);

// WHEN
displayWhen(TEST_NAME);

assertSearch(UserType.class, createOrgSubtreeQuery(ORG_MINISTRY_OF_OFFENSE_OID), USER_LECHUCK_OID, USER_GUYBRUSH_OID, userCobbOid, USER_ESTEVAN_OID);
assertSearch(UserType.class, createOrgSubtreeAndNameQuery(ORG_MINISTRY_OF_OFFENSE_OID, USER_GUYBRUSH_USERNAME), USER_GUYBRUSH_OID);
assertSearch(ObjectType.class, createOrgSubtreeAndNameQuery(ORG_MINISTRY_OF_OFFENSE_OID, USER_GUYBRUSH_USERNAME), USER_GUYBRUSH_OID);

assertSuperuserAccess(NUMBER_OF_ALL_USERS);

assertGlobalStateUntouched();
}

private ObjectQuery createOrgSubtreeAndNameQuery(String orgOid, String name) {
return queryFor(ObjectType.class)
.isChildOf(orgOid)
.and()
.item(ObjectType.F_NAME).eqPoly(name)
.build();
}

@Override
protected void cleanupAutzTest(String userOid, int expectedAssignments) throws ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException, ObjectAlreadyExistsException, PolicyViolationException, SecurityViolationException, IOException {
Expand Down

0 comments on commit 27ab373

Please sign in to comment.