use of gov.ca.cwds.security.realm.PerryAccount in project api-core by ca-cwds.
the class StaffPrivilegeUtilTest method toStaffPersonPrivilegeTypes_success_whenCountySealed.
@Test
public void toStaffPersonPrivilegeTypes_success_whenCountySealed() {
// given
final PerryAccount input = initPerryAccountWithPrivileges("Sealed");
// when
final Set<StaffPrivilegeType> actual = StaffPrivilegeUtil.toStaffPersonPrivilegeTypes(input);
// then
assertThat(actual.size(), is(1));
assertThat(actual, contains(COUNTY_SEALED));
}
use of gov.ca.cwds.security.realm.PerryAccount in project api-core by ca-cwds.
the class PerryAccountUtils method initPerryAccountWithPrivileges.
public static PerryAccount initPerryAccountWithPrivileges(String... privileges) {
final PerryAccount perryAccount = new PerryAccount();
final HashSet<String> privilegeSet = new HashSet<>();
privilegeSet.addAll(Arrays.asList(privileges));
perryAccount.setPrivileges(privilegeSet);
return perryAccount;
}
use of gov.ca.cwds.security.realm.PerryAccount in project api-core by ca-cwds.
the class ClientResultReadAuthorizerTest method initUserAccount.
private void initUserAccount(String userCountyCwsCode, String userCountyName, String... privileges) {
final PerryAccount perryAccount = initPerryAccountWithPrivileges(privileges);
perryAccount.setCountyCwsCode(userCountyCwsCode);
perryAccount.setCountyName(userCountyName);
mockStatic(PerrySubject.class);
when(PerrySubject.getPerryAccount()).thenReturn(perryAccount);
}
use of gov.ca.cwds.security.realm.PerryAccount in project api-core by ca-cwds.
the class SubstituteCareProviderCreateAuthorizerTest method checkResourceMgmtAuthorized.
@Test
public void checkResourceMgmtAuthorized() {
// given
final PerryAccount perryAccount = initPerryAccountWithPrivileges("Resource Mgmt Placement Facility Maint");
perryAccount.setCountyCwsCode("1126");
perryAccount.setCountyCode("99");
perryAccount.setCountyName("State of California");
mockStatic(PerrySubject.class);
when(PerrySubject.getPerryAccount()).thenReturn(perryAccount);
final SubstituteCareProvider substituteCareProvider = initSCP();
// when
final boolean actual = testSubject.checkInstance(substituteCareProvider);
// then
assertThat(actual, is(true));
}
use of gov.ca.cwds.security.realm.PerryAccount in project api-core by ca-cwds.
the class SubstituteCareProviderCreateAuthorizerTest method checkCWSCaseManagementUnauthorized.
@Test
public void checkCWSCaseManagementUnauthorized() {
// given
final PerryAccount perryAccount = initPerryAccountWithPrivileges("CWS Case Management System");
perryAccount.setCountyCwsCode("1068");
perryAccount.setCountyCode("01");
perryAccount.setCountyName("Alameda");
mockStatic(PerrySubject.class);
when(PerrySubject.getPerryAccount()).thenReturn(perryAccount);
final SubstituteCareProvider substituteCareProvider = initSCP();
// when
final boolean actual = testSubject.checkInstance(substituteCareProvider);
// then
assertThat(actual, is(false));
}
Aggregations