Skip to content

Commit

Permalink
Feat : Code cleanup for deprecated APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
saimanaswini-k committed Sep 9, 2024
1 parent d14e96b commit d0434f6
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 42 deletions.
2 changes: 1 addition & 1 deletion service/app/util/RequestInterceptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private RequestInterceptor() {}
apiHeaderIgnoreMap.put("/v1/course/batch/search", var);
apiHeaderIgnoreMap.put("/v1/cache/clear", var);
apiHeaderIgnoreMap.put("/private/v1/course/batch/create", var);
apiHeaderIgnoreMap.put("/v1/course/create", var);
//apiHeaderIgnoreMap.put("/v1/course/create", var);
apiHeaderIgnoreMap.put("/v2/user/courses/list", var);
apiHeaderIgnoreMap.put("/v1/collection/summary", var);
}
Expand Down
82 changes: 41 additions & 41 deletions service/test/controllers/coursemanagement/CourseControllerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,56 +24,56 @@
"sun.security.ssl.*", "javax.net.ssl.*", "javax.crypto.*"})
public class CourseControllerTest extends BaseApplicationTest {

String COURSE_CREATE_URL = "/v1/course/create";
//String COURSE_CREATE_URL = "/v1/course/create";

@Before
public void before() {
setup(ACTOR_NAMES.COURSE_MANAGEMENT_ACTOR, DummyActor.class);
}

@Test
public void testCourseCreateSuccess() {
Http.RequestBuilder req =
new Http.RequestBuilder()
.uri(COURSE_CREATE_URL)
.bodyJson(createCourseRequest("application/vnd.ekstep.content-collection", "Course"))
.method("POST");
Result result = Helpers.route(application, req);
Assert.assertEquals(200, result.status());
}
//@Test
//public void testCourseCreateSuccess() {
// Http.RequestBuilder req =
// new Http.RequestBuilder()
// .uri(COURSE_CREATE_URL)
// .bodyJson(createCourseRequest("application/vnd.ekstep.content-collection", "Course"))
// .method("POST");
// Result result = Helpers.route(application, req);
// Assert.assertEquals(200, result.status());
//}

@Test
public void testCourseCreateWithInvalidRequest() {
Http.RequestBuilder req =
new Http.RequestBuilder()
.uri(COURSE_CREATE_URL)
.bodyJson(createCourseInvalidRequest())
.method("POST");
Result result = Helpers.route(application, req);
Assert.assertEquals(400, result.status());
}
//@Test
//public void testCourseCreateWithInvalidRequest() {
// Http.RequestBuilder req =
// new Http.RequestBuilder()
// .uri(COURSE_CREATE_URL)
// .bodyJson(createCourseInvalidRequest())
// .method("POST");
// Result result = Helpers.route(application, req);
// Assert.assertEquals(400, result.status());
//}

@Test
public void testCourseCreateWithInvalidContentType() {
Http.RequestBuilder req =
new Http.RequestBuilder()
.uri(COURSE_CREATE_URL)
.bodyJson(createCourseRequest("application/vnd.ekstep.content-collection", "InvalidContent"))
.method("POST");
Result result = Helpers.route(application, req);
Assert.assertEquals(400, result.status());
}
//@Test
//public void testCourseCreateWithInvalidContentType() {
// Http.RequestBuilder req =
// new Http.RequestBuilder()
// .uri(COURSE_CREATE_URL)
// .bodyJson(createCourseRequest("application/vnd.ekstep.content-collection", "InvalidContent"))
// .method("POST");
// Result result = Helpers.route(application, req);
// Assert.assertEquals(400, result.status());
//}

@Test
public void testCourseCreateWithInvalidMimeType() {
Http.RequestBuilder req =
new Http.RequestBuilder()
.uri(COURSE_CREATE_URL)
.bodyJson(createCourseRequest("application/InvalidCollection", "Course"))
.method("POST");
Result result = Helpers.route(application, req);
Assert.assertEquals(400, result.status());
}
//@Test
//public void testCourseCreateWithInvalidMimeType() {
// Http.RequestBuilder req =
// new Http.RequestBuilder()
// .uri(COURSE_CREATE_URL)
// .bodyJson(createCourseRequest("application/InvalidCollection", "Course"))
// .method("POST");
// Result result = Helpers.route(application, req);
// Assert.assertEquals(400, result.status());
//}

private JsonNode createCourseRequest(String mimeType, String contentType) {
Map<String, Object> courseMap = new HashMap<>();
Expand Down

0 comments on commit d0434f6

Please sign in to comment.