From 6bb904179b3c1f4cc3a6e579462b96b294d34642 Mon Sep 17 00:00:00 2001 From: NehaVerma Date: Tue, 29 Jun 2021 12:13:08 +0530 Subject: [PATCH] SB-24273:testcase with valid createdFor --- .../test/course/batch/CreateCourseBatchTest.java | 2 +- .../integration/test/course/batch/GetCourseBatchTest.java | 1 + .../test/course/batch/UpdateCourseBatchTest.java | 7 ++++++- .../request.json | 5 +++-- .../request.json | 0 .../response.json | 0 .../request.json | 0 .../response.json | 0 8 files changed, 11 insertions(+), 4 deletions(-) rename lms_service_api_test/src/test/resources/{templates.course.batch.update.testUpdateCourseBatchFailureWithInvalidCreatedFor => templates/course/batch/update/testUpdateCourseBatchFailureWithInvalidCreatedFor}/request.json (100%) rename lms_service_api_test/src/test/resources/{templates.course.batch.update.testUpdateCourseBatchFailureWithInvalidCreatedFor => templates/course/batch/update/testUpdateCourseBatchFailureWithInvalidCreatedFor}/response.json (100%) rename lms_service_api_test/src/test/resources/{templates.course.batch.update.testUpdateCourseBatchSuccessWithValidCreatedFor => templates/course/batch/update/testUpdateCourseBatchSuccessWithValidCreatedFor}/request.json (100%) rename lms_service_api_test/src/test/resources/{templates.course.batch.update.testUpdateCourseBatchSuccessWithValidCreatedFor => templates/course/batch/update/testUpdateCourseBatchSuccessWithValidCreatedFor}/response.json (100%) diff --git a/lms_service_api_test/src/test/java/org/sunbird/integration/test/course/batch/CreateCourseBatchTest.java b/lms_service_api_test/src/test/java/org/sunbird/integration/test/course/batch/CreateCourseBatchTest.java index a8c6d223..ff54bf1a 100644 --- a/lms_service_api_test/src/test/java/org/sunbird/integration/test/course/batch/CreateCourseBatchTest.java +++ b/lms_service_api_test/src/test/java/org/sunbird/integration/test/course/batch/CreateCourseBatchTest.java @@ -46,7 +46,7 @@ public class CreateCourseBatchTest extends BaseCitrusTestRunner { "testCreateCourseBatchFailureWithParticipant"; public static final String TEST_CREATE_COURSE_BATCH_SUCCESS_WITH_CREATED_FOR = - "templates.course.batch.create.testCreateCourseBatchSuccessWithCreatedFor"; + "testCreateCourseBatchSuccessWithCreatedFor"; public static final String TEST_CREATE_COURSE_BATCH_SUCCESS_OPEN_BATCH = "testCreateCourseBatchSuccessOpenBatch"; public static final String TEST_CREATE_COURSE_BATCH_SUCCESS_OPEN_BATCH_WITH_MENTORS = diff --git a/lms_service_api_test/src/test/java/org/sunbird/integration/test/course/batch/GetCourseBatchTest.java b/lms_service_api_test/src/test/java/org/sunbird/integration/test/course/batch/GetCourseBatchTest.java index 77fc8f16..117acd32 100644 --- a/lms_service_api_test/src/test/java/org/sunbird/integration/test/course/batch/GetCourseBatchTest.java +++ b/lms_service_api_test/src/test/java/org/sunbird/integration/test/course/batch/GetCourseBatchTest.java @@ -82,6 +82,7 @@ private void beforeTest(boolean isOpen) { variable("courseUnitId", ContentStoreUtil.getCourseUnitId()); variable("resourceId", ContentStoreUtil.getResourceId()); variable("startDate", CreateCourseBatchTest.TODAY_DATE); + variable("endDate", UpdateCourseBatchTest.END_DATE); String courseId = System.getenv("sunbird_course_id"); if (StringUtils.isBlank(courseId)) courseId= PropertiesReader.getInstance().getProperty("sunbird_course_id"); diff --git a/lms_service_api_test/src/test/java/org/sunbird/integration/test/course/batch/UpdateCourseBatchTest.java b/lms_service_api_test/src/test/java/org/sunbird/integration/test/course/batch/UpdateCourseBatchTest.java index ac23e11e..d7607ec7 100644 --- a/lms_service_api_test/src/test/java/org/sunbird/integration/test/course/batch/UpdateCourseBatchTest.java +++ b/lms_service_api_test/src/test/java/org/sunbird/integration/test/course/batch/UpdateCourseBatchTest.java @@ -37,13 +37,14 @@ public class UpdateCourseBatchTest extends BaseCitrusTestRunner { private static final String TEST_UPDATE_COURSE_BATCH_SUCCESS_WITH_VALID_CREATED_FOR = "testUpdateCourseBatchSuccessWithValidCreatedFor"; private static final String TEST_UPDATE_COURSE_BATCH_FAILURE_WITH_INVALID_CREATED_FOR = - "templates.course.batch.update.testUpdateCourseBatchFailureWithInvalidCreatedFor"; + "testUpdateCourseBatchFailureWithInvalidCreatedFor"; private static String courseBatchId = "FT_Course_Batch_Id" + Instant.now().getEpochSecond(); public static final String TEMPLATE_DIR = "templates/course/batch/update"; public static final String START_DATE = calculateDate(3); public static final String END_DATE = calculateDate(8); public static final String FUTURE_START_DATE = calculateDate(5); + public static final String FUTURE_ENROLLMENT_END_DATE = calculateDate(10); private String getUpdateCourseBatchUrl() { return getLmsApiUriPath("/api/course/v1/batch/update", "/v1/course/batch/update"); } @@ -143,6 +144,10 @@ public void testUpdateCourseBatchFailure( getTestCase().setName(testName); beforeTest(isOpenBatch); variable("startDate", START_DATE); + if(testName.equals(TEST_UPDATE_COURSE_BATCH_FAILURE_WITH_ENROLLMENT_END_DATE_AFTER_END_DATE)){ + variable("futureEnrollmentEndDate", FUTURE_ENROLLMENT_END_DATE); + variable("endDate", END_DATE); + } performPatchTest( this, TEMPLATE_DIR, diff --git a/lms_service_api_test/src/test/resources/templates/course/batch/update/testUpdateCourseBatchFailureEnrollmentEndDateAfterEndDate/request.json b/lms_service_api_test/src/test/resources/templates/course/batch/update/testUpdateCourseBatchFailureEnrollmentEndDateAfterEndDate/request.json index fe28b654..cf3fce56 100644 --- a/lms_service_api_test/src/test/resources/templates/course/batch/update/testUpdateCourseBatchFailureEnrollmentEndDateAfterEndDate/request.json +++ b/lms_service_api_test/src/test/resources/templates/course/batch/update/testUpdateCourseBatchFailureEnrollmentEndDateAfterEndDate/request.json @@ -2,7 +2,8 @@ "request": { "courseId": "${courseId}", "id":"${batchId}", - "startDate":"${futureStartDate}", - "enrollmentEndDate":"2019-09-10" + "startDate":"${startDate}", + "enrollmentEndDate":"${futureEnrollmentEndDate}", + "endDate":"${endDate}" } } diff --git a/lms_service_api_test/src/test/resources/templates.course.batch.update.testUpdateCourseBatchFailureWithInvalidCreatedFor/request.json b/lms_service_api_test/src/test/resources/templates/course/batch/update/testUpdateCourseBatchFailureWithInvalidCreatedFor/request.json similarity index 100% rename from lms_service_api_test/src/test/resources/templates.course.batch.update.testUpdateCourseBatchFailureWithInvalidCreatedFor/request.json rename to lms_service_api_test/src/test/resources/templates/course/batch/update/testUpdateCourseBatchFailureWithInvalidCreatedFor/request.json diff --git a/lms_service_api_test/src/test/resources/templates.course.batch.update.testUpdateCourseBatchFailureWithInvalidCreatedFor/response.json b/lms_service_api_test/src/test/resources/templates/course/batch/update/testUpdateCourseBatchFailureWithInvalidCreatedFor/response.json similarity index 100% rename from lms_service_api_test/src/test/resources/templates.course.batch.update.testUpdateCourseBatchFailureWithInvalidCreatedFor/response.json rename to lms_service_api_test/src/test/resources/templates/course/batch/update/testUpdateCourseBatchFailureWithInvalidCreatedFor/response.json diff --git a/lms_service_api_test/src/test/resources/templates.course.batch.update.testUpdateCourseBatchSuccessWithValidCreatedFor/request.json b/lms_service_api_test/src/test/resources/templates/course/batch/update/testUpdateCourseBatchSuccessWithValidCreatedFor/request.json similarity index 100% rename from lms_service_api_test/src/test/resources/templates.course.batch.update.testUpdateCourseBatchSuccessWithValidCreatedFor/request.json rename to lms_service_api_test/src/test/resources/templates/course/batch/update/testUpdateCourseBatchSuccessWithValidCreatedFor/request.json diff --git a/lms_service_api_test/src/test/resources/templates.course.batch.update.testUpdateCourseBatchSuccessWithValidCreatedFor/response.json b/lms_service_api_test/src/test/resources/templates/course/batch/update/testUpdateCourseBatchSuccessWithValidCreatedFor/response.json similarity index 100% rename from lms_service_api_test/src/test/resources/templates.course.batch.update.testUpdateCourseBatchSuccessWithValidCreatedFor/response.json rename to lms_service_api_test/src/test/resources/templates/course/batch/update/testUpdateCourseBatchSuccessWithValidCreatedFor/response.json