Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat : Code cleanup for deprecated APIs #623

Open
wants to merge 1 commit into
base: release-7.0.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading