fix(接口测试): 接口管理模块接口用例数据效验

This commit is contained in:
lan-yonghui 2023-11-30 22:07:41 +08:00 committed by Craftsman
parent 7a1ac27e6c
commit 83ad5af322
2 changed files with 3 additions and 2 deletions

View File

@ -667,7 +667,8 @@ public class ApiTestCaseControllerTests extends BaseTest {
request.setTags(new LinkedHashSet<>(List.of("tag1", "tag3", "tag4")));
responsePost(BATCH_EDIT, request);
ApiTestCaseExample example = new ApiTestCaseExample();
example.createCriteria().andProjectIdEqualTo(DEFAULT_PROJECT_ID).andDeletedEqualTo(false);
List<String> ids = extApiTestCaseMapper.getIds(request, false);
example.createCriteria().andProjectIdEqualTo(DEFAULT_PROJECT_ID).andDeletedEqualTo(false).andIdIn(ids);
apiTestCaseMapper.selectByExample(example).forEach(apiTestCase -> {
Assertions.assertTrue(apiTestCase.getTags().contains("tag1"));
Assertions.assertTrue(apiTestCase.getTags().contains("tag3"));

View File

@ -22,7 +22,7 @@ INSERT INTO `api_test_case` (`id`, `name`, `priority`, `num`, `tags`, `status`,
INSERT INTO `api_test_case` (`id`, `name`, `priority`, `num`, `tags`, `status`, `last_report_status`, `last_report_id`, `pos`, `project_id`, `api_definition_id`, `version_id`, `environment_id`, `create_time`, `create_user`, `update_time`, `update_user`, `delete_time`, `delete_user`, `deleted`) VALUES ('3ee2ae9c-a680-4ed6-b115-1f6ab8980104', '查询Linux主机', 'P0', 100002008, NULL, 'PENDING', NULL, '10008', 10000, '100001100001', '1005', '100570499574136985', 'admin', 1699500298164, 'admin', 1699500298164, 'admin', NULL, NULL, b'0');
INSERT INTO `api_test_case` (`id`, `name`, `priority`, `num`, `tags`, `status`, `last_report_status`, `last_report_id`, `pos`, `project_id`, `api_definition_id`, `version_id`, `environment_id`, `create_time`, `create_user`, `update_time`, `update_user`, `delete_time`, `delete_user`, `deleted`) VALUES ('3ee2ae9c-a680-4ed6-b115-1f6ab8980545', '查询Linux主机', 'P0', 100002009, NULL, 'PENDING', NULL, NULL, 10000, '100001100001', '1005', '100570499574136985', 'admin', 1699500298164, 'admin', 1699500298164, 'admin', NULL, NULL, b'0');
DELETE FROM `api_report` WHERE `id` in ('10001','10002','10003','10004','10005','10006','10007','10008','10009');
DELETE FROM `api_report` WHERE `id` in ('10001','10002','10003','10004','10005','10006','10007','10008');
INSERT INTO `api_report` (`id`, `name`, `resource_id`, `create_time`, `update_time`, `create_user`, `update_user`, `deleted`, `status`, `start_time`, `end_time`, `run_mode`, `pool_id`, `trigger_mode`, `version_id`, `project_id`, `integrated_report_id`, `integrated`) VALUES ('10001', '报告001', 'resource_id_10001', 1680624405386, 1680624405386, 'admin', 'admin', b'0', 'SUCCESS', 1680624405386, 1680624405386, 'API', 'pol_id_100001', 'hand', NULL, '100001100001', 'NONE', b'0');
INSERT INTO `api_report` (`id`, `name`, `resource_id`, `create_time`, `update_time`, `create_user`, `update_user`, `deleted`, `status`, `start_time`, `end_time`, `run_mode`, `pool_id`, `trigger_mode`, `version_id`, `project_id`, `integrated_report_id`, `integrated`) VALUES ('10002', '报告002', 'resource_id_10001', 1680624405386, 1680624405386, 'admin', 'admin', b'0', 'ERROR', 1680624405386, 1680624405386, 'API', 'pol_id_100001', 'hand', NULL, '100001100001', 'NONE', b'0');
INSERT INTO `api_report` (`id`, `name`, `resource_id`, `create_time`, `update_time`, `create_user`, `update_user`, `deleted`, `status`, `start_time`, `end_time`, `run_mode`, `pool_id`, `trigger_mode`, `version_id`, `project_id`, `integrated_report_id`, `integrated`) VALUES ('10003', '报告003', 'resource_id_10001', 1680624405386, 1680624405386, 'admin', 'admin', b'0', 'FAKE_ERROR', 1680624405386, 1680624405386, 'API', 'pol_id_100001', 'hand', NULL, '100001100001', 'NONE', b'0');