Skip to content

Commit

Permalink
Issues #SB-00 feat:adding for test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
manzarul.haque committed Nov 17, 2017
1 parent b49a975 commit 11ce40d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 2 additions & 0 deletions service/test/ApplicationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -67,4 +68,5 @@ public void testcreateCommonExceptionResponse() {
Result result = new BaseController().createCommonExceptionResponse(new Exception(),null);
assertEquals(ResponseCode.OK.getResponseCode(), result.status());
}

}
32 changes: 31 additions & 1 deletion service/test/IntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {

Expand Down

0 comments on commit 11ce40d

Please sign in to comment.