fix(用例管理): 修复用例评审周期时间可以早于当前时间问题
--bug=1036045 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001036045
This commit is contained in:
parent
babf25ea74
commit
d398de2246
|
@ -6,6 +6,9 @@ permission.functional_case.minder=脑图编辑
|
|||
permission.case_review.name=用例评审
|
||||
permission.case_review.review=评审
|
||||
permission.case_review.relevance=关联/取消关联
|
||||
permission.case_review.start_time=评审周期开始时间不得早于当前时间
|
||||
permission.case_review.end_time=评审周期结束时间不得早于当前时间
|
||||
|
||||
#module:FunctionalCase
|
||||
functional_case.module.default.name=未规划用例
|
||||
review.module.default.name=未规划评审
|
||||
|
|
|
@ -6,6 +6,8 @@ permission.functional_case.comment=Comment
|
|||
permission.case_review.name=Case review
|
||||
permission.case_review.review=Review
|
||||
permission.case_review.relevance=Associate/Disassociate
|
||||
permission.case_review.startTime=The start time of the cycle review cannot be earlier than the current time
|
||||
permission.case_review.endTime=The review cycle end time cannot be earlier than the current time
|
||||
|
||||
#module:FunctionalCase
|
||||
functional_case.module.default.name=Unplanned case
|
||||
|
|
|
@ -6,6 +6,8 @@ permission.functional_case.minder=脑图编辑
|
|||
permission.case_review.name=用例评审
|
||||
permission.case_review.review=评审
|
||||
permission.case_review.relevance=关联/取消关联
|
||||
permission.case_review.start_time=评审周期开始时间不得早于当前时间
|
||||
permission.case_review.end_time=评审周期结束时间不得早于当前时间
|
||||
#module:FunctionalCase
|
||||
functional_case.module.default.name=未规划用例
|
||||
review.module.default.name=未规划评审
|
||||
|
|
|
@ -6,6 +6,8 @@ permission.functional_case.comment=評論
|
|||
permission.case_review.name=用例評審
|
||||
permission.case_review.review=評審
|
||||
permission.case_review.relevance=關聯/取消關聯
|
||||
permission.case_review.start_time=週期評審開始時間不得早於目前時間
|
||||
permission.case_review.end_time=評審週期結束時間不得早於目前時間
|
||||
|
||||
#module:FunctionalCase
|
||||
functional_case.module.default.name=未規劃用例
|
||||
|
|
|
@ -16,6 +16,7 @@ import io.metersphere.provider.BaseCaseProvider;
|
|||
import io.metersphere.sdk.constants.ApplicationNumScope;
|
||||
import io.metersphere.sdk.exception.MSException;
|
||||
import io.metersphere.sdk.util.BeanUtils;
|
||||
import io.metersphere.sdk.util.Translator;
|
||||
import io.metersphere.system.dto.sdk.request.PosRequest;
|
||||
import io.metersphere.system.dto.user.UserDTO;
|
||||
import io.metersphere.system.mapper.ExtUserMapper;
|
||||
|
@ -376,12 +377,12 @@ public class CaseReviewService {
|
|||
private void checkAndSetStartAndEndTime(CaseReviewRequest request, CaseReview caseReview) {
|
||||
long currentZeroTime = getCurrentZeroTime();
|
||||
if (request.getStartTime() != null && request.getStartTime() < currentZeroTime) {
|
||||
throw new MSException("评审周期开始时间不得早于当前时间");
|
||||
throw new MSException(Translator.get("permission.case_review.start_time"));
|
||||
} else {
|
||||
caseReview.setStartTime(request.getStartTime());
|
||||
}
|
||||
if (request.getEndTime() != null && request.getEndTime() < currentZeroTime) {
|
||||
throw new MSException("评审周期结束时间不得早于当前时间");
|
||||
throw new MSException(Translator.get("permission.case_review.end_time"));
|
||||
} else {
|
||||
caseReview.setEndTime(request.getEndTime());
|
||||
}
|
||||
|
|
|
@ -142,6 +142,10 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
caseReviewRequest.setEndTime(1678188103000L);
|
||||
this.requestPost(ADD_CASE_REVIEW, caseReviewRequest).andExpect(status().is5xxServerError());
|
||||
|
||||
caseReviewRequest.setStartTime(1901791303000L);
|
||||
caseReviewRequest.setEndTime(1678188103000L);
|
||||
this.requestPost(ADD_CASE_REVIEW, caseReviewRequest).andExpect(status().is5xxServerError());
|
||||
|
||||
}
|
||||
|
||||
private List<CaseReview> getCaseReviews(String name) {
|
||||
|
@ -232,6 +236,9 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
caseReviewRequestWidthStartTime.setStartTime(1678188043000L);
|
||||
caseReviewRequestWidthStartTime.setEndTime(1678188103000L);
|
||||
this.requestPost(ADD_CASE_REVIEW, caseReviewRequestWidthStartTime).andExpect(status().is5xxServerError());
|
||||
caseReviewRequestWidthStartTime.setStartTime(1901791303000L);
|
||||
caseReviewRequestWidthStartTime.setEndTime(1678188103000L);
|
||||
this.requestPost(ADD_CASE_REVIEW, caseReviewRequestWidthStartTime).andExpect(status().is5xxServerError());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -297,6 +304,9 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
caseReviewRequestWidthStartTime.setStartTime(1678188043000L);
|
||||
caseReviewRequestWidthStartTime.setEndTime(1678188103000L);
|
||||
this.requestPost(ADD_CASE_REVIEW, caseReviewRequestWidthStartTime).andExpect(status().is5xxServerError());
|
||||
caseReviewRequestWidthStartTime.setStartTime(1901791303000L);
|
||||
caseReviewRequestWidthStartTime.setEndTime(1678188103000L);
|
||||
this.requestPost(ADD_CASE_REVIEW, caseReviewRequestWidthStartTime).andExpect(status().is5xxServerError());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -512,6 +522,28 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
caseReviewDTOS = JSON.parseArray(JSON.toJSONString(pageData.getList()), CaseReviewDTO.class);
|
||||
Assertions.assertTrue(CollectionUtils.isNotEmpty(caseReviewDTOS));
|
||||
|
||||
request = new CaseReviewPageRequest();
|
||||
filters = new HashMap<>();
|
||||
request.setFilter(filters);
|
||||
request.setCombine(caseReviewCombine);
|
||||
request.setProjectId("project-gyq-case-review-test_gt");
|
||||
request.setCurrent(1);
|
||||
request.setPageSize(10);
|
||||
mvcResult = this.requestPostWithOkAndReturn(PAGE_CASE_REVIEW, request);
|
||||
// 获取返回值
|
||||
returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||
resultHolder = JSON.parseObject(returnData, ResultHolder.class);
|
||||
// 返回请求正常
|
||||
Assertions.assertNotNull(resultHolder);
|
||||
pageData = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), Pager.class);
|
||||
// 返回值不为空
|
||||
Assertions.assertNotNull(pageData);
|
||||
// 返回值的页码和当前页码相同
|
||||
Assertions.assertEquals(pageData.getCurrent(), request.getCurrent());
|
||||
// 返回的数据量不超过规定要返回的数据量相同
|
||||
Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= request.getPageSize());
|
||||
caseReviewDTOS = JSON.parseArray(JSON.toJSONString(pageData.getList()), CaseReviewDTO.class);
|
||||
Assertions.assertTrue(CollectionUtils.isEmpty(caseReviewDTOS));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
INSERT INTO organization(id, num, name, description, create_time, update_time, create_user, update_user, deleted, delete_user, delete_time) VALUE
|
||||
('organization-gyq-case-review-test', null, 'organization-gyq-case-review-test', 'organization-gyq-case-review-test', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, 'admin', 'admin', 0, null, null);
|
||||
INSERT INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time) VALUES
|
||||
('project-gyq-case-review-test', null, 'organization-gyq-case-review-test', '用例评审项目', '系统默认创建的项目', 'admin', 'admin', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000);
|
||||
('project-gyq-case-review-test', null, 'organization-gyq-case-review-test', '用例评审项目', '系统默认创建的项目', 'admin', 'admin', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000),
|
||||
('project-gyq-case-review-test_gt', null, 'organization-gyq-case-review-test', '用例评审项目2', '系统默认创建的项目', 'admin', 'admin', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000);
|
||||
|
||||
|
||||
INSERT INTO template (id, name, remark, internal, update_time, create_time, create_user, scope_type, scope_id, enable_third_part, ref_id, scene)
|
||||
|
|
Loading…
Reference in New Issue