feat(接口测试): 清除接口定义变更标记接口

--task=1015861 --user=陈建星 【接口测试】接口用例支持同步更新接口变更-是否与定义不一致查询接口 https://www.tapd.cn/55049933/s/1557706
This commit is contained in:
AgAngle 2024-08-02 10:08:27 +08:00 committed by Craftsman
parent 55a33c6a0b
commit 5930968a19
3 changed files with 31 additions and 0 deletions

View File

@ -300,4 +300,12 @@ public class ApiTestCaseController {
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "id desc");
return PageUtils.setPageInfo(page, apiTestCaseService.getReference(request));
}
@GetMapping("/api-change/clear/{id}")
@Operation(summary = "清除接口参数变更标识")
@RequiresPermissions(logical = Logical.OR, value = {PermissionConstants.PROJECT_API_DEFINITION_CASE_ADD, PermissionConstants.PROJECT_API_DEFINITION_CASE_UPDATE})
@CheckOwner(resourceId = "#id", resourceType = "api_test_case")
public void clearApiChange(@PathVariable String id) {
apiTestCaseService.clearApiChange(id);
}
}

View File

@ -944,4 +944,11 @@ public class ApiTestCaseService extends MoveNodeService {
}
}
public void clearApiChange(String id) {
checkResourceExist(id);
ApiTestCase apiTestCase = new ApiTestCase();
apiTestCase.setId(id);
apiTestCase.setApiChange(false);
apiTestCaseMapper.updateByPrimaryKeySelective(apiTestCase);
}
}

View File

@ -113,6 +113,7 @@ public class ApiTestCaseControllerTests extends BaseTest {
private static final String RUN_GET = "run/{0}";
private static final String RUN_POST = "run";
private static final String BATCH_RUN = "batch/run";
private static final String API_CHANGE_CLEAR = "api-change/clear/{id}";
private static final ResultMatcher ERROR_REQUEST_MATCHER = status().is5xxServerError();
private static ApiTestCase apiTestCase;
@ -432,6 +433,21 @@ public class ApiTestCaseControllerTests extends BaseTest {
Assertions.assertEquals(apiTestCaseMapper.selectByPrimaryKey(apiTestCase.getId()).getApiChange(), true);
}
@Test
@Order(3)
public void clearApiChange() throws Exception {
ApiTestCase updateCase = new ApiTestCase();
updateCase.setApiChange(true);
updateCase.setId(apiTestCase.getId());
apiTestCaseMapper.updateByPrimaryKeySelective(updateCase);
this.requestGetWithOk(API_CHANGE_CLEAR, apiTestCase.getId());
Assertions.assertFalse(apiTestCaseMapper.selectByPrimaryKey(apiTestCase.getId()).getApiChange());
// @@校验权限
requestGetPermissionTest(PermissionConstants.PROJECT_API_DEFINITION_CASE_ADD, API_CHANGE_CLEAR, apiTestCase.getId());
requestGetPermissionTest(PermissionConstants.PROJECT_API_DEFINITION_CASE_UPDATE, API_CHANGE_CLEAR, apiTestCase.getId());
}
/**
* 测试关联的文件更新
*