Search in sources :

Example 6 with JsonIdentityAuthParams

use of gov.ca.cwds.test.support.JsonIdentityAuthParams in project cals-api by ca-cwds.

the class FacilityResourceTest method testCallGetFacilityByFacilityIdByPrivCWSCaseManagementSystem.

@Test
public void testCallGetFacilityByFacilityIdByPrivCWSCaseManagementSystem() throws Exception {
    String targetString = Constants.API.FACILITIES + "/" + FACILITY_ID + '?' + TestSecurityFilter.PATH_TO_PRINCIPAL_FIXTURE + '=' + PRINCIPAL_PRIV_CWS_CASE_MANAGEMENT_SYSTEM_JSON;
    JsonIdentityAuthParams params = new JsonIdentityAuthParams(fixture(PRINCIPAL_PRIV_CWS_CASE_MANAGEMENT_SYSTEM_JSON));
    WebTarget target = clientTestRule.target(targetString, params);
    Invocation.Builder invocation = target.request(MediaType.APPLICATION_JSON);
    Response response = invocation.get();
    assertEquals(HttpStatus.SC_OK, response.getStatus());
}
Also used : AssertResponseHelper.assertEqualsResponse(gov.ca.cwds.cals.web.rest.utils.AssertResponseHelper.assertEqualsResponse) Response(javax.ws.rs.core.Response) Invocation(javax.ws.rs.client.Invocation) WebTarget(javax.ws.rs.client.WebTarget) JsonIdentityAuthParams(gov.ca.cwds.test.support.JsonIdentityAuthParams) Test(org.junit.Test) BaseCalsApiIntegrationTest(gov.ca.cwds.cals.BaseCalsApiIntegrationTest)

Example 7 with JsonIdentityAuthParams

use of gov.ca.cwds.test.support.JsonIdentityAuthParams in project cals-api by ca-cwds.

the class FacilityChildResourceTest method testGetFacilityChildrenWithAssignedWorkerPresent.

@Test
public void testGetFacilityChildrenWithAssignedWorkerPresent() throws Exception {
    String pathInfo = FACILITIES + "/{" + FACILITY_ID + "}/" + CHILDREN + "?" + TestSecurityFilter.PATH_TO_PRINCIPAL_FIXTURE + '=' + SECURITY_CLIENT_PRINCIPAL_SAME_COUNTY_SEALED_JSON;
    pathInfo = pathInfo.replace("{" + FACILITY_ID + "}", "412252222");
    JsonIdentityAuthParams params = new JsonIdentityAuthParams(fixture(SECURITY_CLIENT_PRINCIPAL_SAME_COUNTY_SEALED_JSON));
    WebTarget target = clientTestRule.target(pathInfo, params);
    Invocation.Builder invocation = target.request(MediaType.APPLICATION_JSON);
    FacilityChildrenDto facilityChildDTO = invocation.get(FacilityChildrenDto.class);
    String fixture = fixture("fixtures/facility/facility-children-response-assigned-worker-present.json");
    assertEqualsResponse(fixture, transformDTOtoJSON(facilityChildDTO));
}
Also used : FacilityChildrenDto(gov.ca.cwds.cals.service.dto.FacilityChildrenDto) Invocation(javax.ws.rs.client.Invocation) WebTarget(javax.ws.rs.client.WebTarget) JsonIdentityAuthParams(gov.ca.cwds.test.support.JsonIdentityAuthParams) Test(org.junit.Test) BaseCalsApiIntegrationTest(gov.ca.cwds.cals.BaseCalsApiIntegrationTest)

Example 8 with JsonIdentityAuthParams

use of gov.ca.cwds.test.support.JsonIdentityAuthParams in project cals-api by ca-cwds.

the class FacilityResourceTest method testCallGetFacilityByFacilityIdByPrivResourceManagement.

@Test
public void testCallGetFacilityByFacilityIdByPrivResourceManagement() throws Exception {
    String targetString = Constants.API.FACILITIES + "/" + FACILITY_ID + '?' + TestSecurityFilter.PATH_TO_PRINCIPAL_FIXTURE + '=' + PRINCIPAL_PRIV_RESOURCE_MANAGEMENT_JSON;
    JsonIdentityAuthParams params = new JsonIdentityAuthParams(fixture(PRINCIPAL_PRIV_RESOURCE_MANAGEMENT_JSON));
    WebTarget target = clientTestRule.target(targetString, params);
    Invocation.Builder invocation = target.request(MediaType.APPLICATION_JSON);
    Response response = invocation.get();
    assertEquals(HttpStatus.SC_OK, response.getStatus());
}
Also used : AssertResponseHelper.assertEqualsResponse(gov.ca.cwds.cals.web.rest.utils.AssertResponseHelper.assertEqualsResponse) Response(javax.ws.rs.core.Response) Invocation(javax.ws.rs.client.Invocation) WebTarget(javax.ws.rs.client.WebTarget) JsonIdentityAuthParams(gov.ca.cwds.test.support.JsonIdentityAuthParams) Test(org.junit.Test) BaseCalsApiIntegrationTest(gov.ca.cwds.cals.BaseCalsApiIntegrationTest)

Aggregations

JsonIdentityAuthParams (gov.ca.cwds.test.support.JsonIdentityAuthParams)8 WebTarget (javax.ws.rs.client.WebTarget)7 Invocation (javax.ws.rs.client.Invocation)5 BaseCalsApiIntegrationTest (gov.ca.cwds.cals.BaseCalsApiIntegrationTest)4 Test (org.junit.Test)4 AssertResponseHelper.assertEqualsResponse (gov.ca.cwds.cals.web.rest.utils.AssertResponseHelper.assertEqualsResponse)3 Response (javax.ws.rs.core.Response)3 FacilityChildrenDto (gov.ca.cwds.cals.service.dto.FacilityChildrenDto)1 PerryV2DevModeTokenProvider (gov.ca.cwds.test.support.PerryV2DevModeTokenProvider)1