From 4def87fdf530f783323a5686db95d857dd6e8b4e Mon Sep 17 00:00:00 2001 From: eHanan Date: Thu, 9 Jan 2020 14:19:20 +0000 Subject: Fixed testOnGetPackageVnfd_UnauthorizedClient_Fail Change-Id: I916182cf97ea4a78fe7dfe19de2cce03b8d9a7ea Issue-ID: SO-2414 Signed-off-by: eHanan --- .../rest/Sol003PackageManagementControllerTest.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter') diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementControllerTest.java index 623cba7b8b..df381f15c2 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementControllerTest.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementControllerTest.java @@ -512,14 +512,13 @@ public class Sol003PackageManagementControllerTest { @Test public void testOnGetPackageVnfd_UnauthorizedClient_Fail() { - final String testURL = - "http://localhost:" + port + PACKAGE_MANAGEMENT_BASE_URL + "/vnf_packages/" + VNF_PACKAGE_ID + "/vnfd"; - final HttpEntity request = new HttpEntity<>(basicHttpHeadersProvider.getHttpHeaders()); - final ResponseEntity responseEntity = - restTemplate.exchange(testURL, HttpMethod.GET, request, ProblemDetails.class); + mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/vnfd")) + .andExpect(method(HttpMethod.GET)).andRespond(withStatus(HttpStatus.UNAUTHORIZED)); + + final ResponseEntity responseEntity = sendHttpRequest(VNF_PACKAGE_ID + "/vnfd"); assertTrue(responseEntity.getBody() instanceof ProblemDetails); - assertEquals(HttpStatus.UNAUTHORIZED, responseEntity.getStatusCode()); + assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, responseEntity.getStatusCode()); } @Test -- cgit 1.2.3-korg