diff --git a/service/test/ApplicationTest.java b/service/test/ApplicationTest.java index 474d29683d..74133f8948 100644 --- a/service/test/ApplicationTest.java +++ b/service/test/ApplicationTest.java @@ -4,6 +4,7 @@ import org.sunbird.common.exception.ProjectCommonException; import org.sunbird.common.models.response.Response; import org.sunbird.common.models.response.ResponseParams; +import org.sunbird.common.request.Request; import org.sunbird.common.responsecode.ResponseCode; import controllers.BaseController; @@ -67,4 +68,5 @@ public void testcreateCommonExceptionResponse() { Result result = new BaseController().createCommonExceptionResponse(new Exception(),null); assertEquals(ResponseCode.OK.getResponseCode(), result.status()); } + } diff --git a/service/test/IntegrationTest.java b/service/test/IntegrationTest.java index 90d5b0ccf0..38f6a4c361 100644 --- a/service/test/IntegrationTest.java +++ b/service/test/IntegrationTest.java @@ -70,9 +70,39 @@ public void testUserFailureLogin() { RequestBuilder req = new RequestBuilder().bodyJson(json).uri("/v1/user/login").method("POST"); req.headers(headerMap); Result result = route(req); - assertEquals(400, result.status()); + assertEquals(401, result.status()); } + @Test + public void testUserFailureLogout() { + String data = "{\"request\":{\"authToken\":\"some token value\",\"userId\":\"123344-334444-5566\"}}"; + JsonNode json = Json.parse(data); + RequestBuilder req = new RequestBuilder().bodyJson(json).uri("/v1/user/logout").method("POST"); + req.headers(headerMap); + Result result = route(req); + assertEquals(401, result.status()); + } + + + @Test + public void testFailureChangePassword() { + String data = "{\"request\":{\"authToken\":\"some token value\",\"oldPassword\":\"password1\",\"Password\":\"password\"}}"; + JsonNode json = Json.parse(data); + RequestBuilder req = new RequestBuilder().bodyJson(json).uri("/v1/user/changepassword").method("POST"); + req.headers(headerMap); + Result result = route(req); + assertEquals(401, result.status()); + } + + + @Test + public void testGetUserWithWrongId() { + RequestBuilder req = new RequestBuilder().uri("/v1/user/getprofile/1234-5465-1234-455").method("GET"); + req.headers(headerMap); + Result result = route(req); + assertEquals(401, result.status()); + } + @AfterClass public static void stopApp() {