Search in sources :

Example 1 with StaffPrivilegeType

use of gov.ca.cwds.authorizer.StaffPrivilegeType in project api-core by ca-cwds.

the class StaffPrivilegeUtilTest method toStaffPersonPrivilegeTypes_success_whenAllStateLevels.

@Test
public void toStaffPersonPrivilegeTypes_success_whenAllStateLevels() {
    // given
    final PerryAccount input = initPerryAccountWithPrivileges("CWS Case Management System", "Sensitive Persons", "Sealed", "...some noise");
    input.setCountyName("State of California");
    // when
    final Set<StaffPrivilegeType> actual = StaffPrivilegeUtil.toStaffPersonPrivilegeTypes(input);
    // then
    assertThat(actual.size(), is(3));
    assertThat(actual, containsInAnyOrder(SOCIAL_WORKER_ONLY, STATE_SENSITIVE, STATE_SEALED));
}
Also used : StaffPrivilegeType(gov.ca.cwds.authorizer.StaffPrivilegeType) PerryAccount(gov.ca.cwds.security.realm.PerryAccount) Test(org.junit.Test)

Example 2 with StaffPrivilegeType

use of gov.ca.cwds.authorizer.StaffPrivilegeType in project api-core by ca-cwds.

the class StaffPrivilegeUtilTest method toStaffPersonPrivilegeTypes_success_whenAllCountyLevels.

@Test
public void toStaffPersonPrivilegeTypes_success_whenAllCountyLevels() {
    // given
    final PerryAccount input = initPerryAccountWithPrivileges("CWS Case Management System", "Sensitive Persons", "Sealed", "...some noise");
    input.setCountyName("any county name");
    // when
    final Set<StaffPrivilegeType> actual = StaffPrivilegeUtil.toStaffPersonPrivilegeTypes(input);
    // then
    assertThat(actual.size(), is(3));
    assertThat(actual, containsInAnyOrder(SOCIAL_WORKER_ONLY, COUNTY_SENSITIVE, COUNTY_SEALED));
}
Also used : StaffPrivilegeType(gov.ca.cwds.authorizer.StaffPrivilegeType) PerryAccount(gov.ca.cwds.security.realm.PerryAccount) Test(org.junit.Test)

Example 3 with StaffPrivilegeType

use of gov.ca.cwds.authorizer.StaffPrivilegeType in project api-core by ca-cwds.

the class StaffPrivilegeUtilTest method toStaffPersonPrivilegeTypes_empty_whenNoPerryPrivileges.

@Test
public void toStaffPersonPrivilegeTypes_empty_whenNoPerryPrivileges() {
    // given
    final PerryAccount input = new PerryAccount();
    // when
    final Set<StaffPrivilegeType> actual = StaffPrivilegeUtil.toStaffPersonPrivilegeTypes(input);
    // then
    assertThat(actual.isEmpty(), is(true));
}
Also used : StaffPrivilegeType(gov.ca.cwds.authorizer.StaffPrivilegeType) PerryAccount(gov.ca.cwds.security.realm.PerryAccount) Test(org.junit.Test)

Example 4 with StaffPrivilegeType

use of gov.ca.cwds.authorizer.StaffPrivilegeType in project api-core by ca-cwds.

the class StaffPrivilegeUtilTest method toStaffPersonPrivilegeTypes_success_whenStateSealed.

@Test
public void toStaffPersonPrivilegeTypes_success_whenStateSealed() {
    // given
    final PerryAccount input = initPerryAccountWithPrivileges("Sealed");
    input.setCountyName("State of California");
    // when
    final Set<StaffPrivilegeType> actual = StaffPrivilegeUtil.toStaffPersonPrivilegeTypes(input);
    // then
    assertThat(actual.size(), is(1));
    assertThat(actual, contains(STATE_SEALED));
}
Also used : StaffPrivilegeType(gov.ca.cwds.authorizer.StaffPrivilegeType) PerryAccount(gov.ca.cwds.security.realm.PerryAccount) Test(org.junit.Test)

Example 5 with StaffPrivilegeType

use of gov.ca.cwds.authorizer.StaffPrivilegeType in project api-core by ca-cwds.

the class StaffPrivilegeUtilTest method toStaffPersonPrivilegeTypes_empty_whenEmptyPerryPrivileges.

@Test
public void toStaffPersonPrivilegeTypes_empty_whenEmptyPerryPrivileges() {
    // given
    final PerryAccount input = initPerryAccountWithPrivileges();
    // when
    final Set<StaffPrivilegeType> actual = StaffPrivilegeUtil.toStaffPersonPrivilegeTypes(input);
    // then
    assertThat(actual.isEmpty(), is(true));
}
Also used : StaffPrivilegeType(gov.ca.cwds.authorizer.StaffPrivilegeType) PerryAccount(gov.ca.cwds.security.realm.PerryAccount) Test(org.junit.Test)

Aggregations

StaffPrivilegeType (gov.ca.cwds.authorizer.StaffPrivilegeType)10 PerryAccount (gov.ca.cwds.security.realm.PerryAccount)10 Test (org.junit.Test)10