diff --git a/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectControllerTests.java b/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectControllerTests.java index 4b267bd590..fb1839c7f9 100644 --- a/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectControllerTests.java +++ b/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectControllerTests.java @@ -256,7 +256,7 @@ public class ProjectControllerTests extends BaseTest { @Test @Order(7) public void testUpdateProject() throws Exception { - UpdateProjectRequest project = this.generatorUpdate("organizationId", "projectId1","project-TestName", "Edit name", true, List.of("admin1")); + UpdateProjectRequest project = this.generatorUpdate("organizationId", "projectId1", "project-TestName", "Edit name", true, List.of("admin1")); Project projectExtend = projectMapper.selectByPrimaryKey("projectId1"); List moduleIds = new ArrayList<>(); if (StringUtils.isNotBlank(projectExtend.getModuleSetting())) { @@ -299,19 +299,19 @@ public class ProjectControllerTests extends BaseTest { @Order(8) public void testUpdateProjectError() throws Exception { //项目名称存在 500 - UpdateProjectRequest project = this.generatorUpdate("organizationId", "projectId3","project-TestName", "description", true, List.of("admin")); + UpdateProjectRequest project = this.generatorUpdate("organizationId", "projectId3", "project-TestName", "description", true, List.of("admin")); this.requestPost(updateProject, project, ERROR_REQUEST_MATCHER); //参数组织Id为空 - project = this.generatorUpdate(null, "projectId",null, null, true , List.of("admin")); + project = this.generatorUpdate(null, "projectId", null, null, true, List.of("admin")); this.requestPost(updateProject, project, BAD_REQUEST_MATCHER); //项目Id为空 - project = this.generatorUpdate("organizationId", null,null, null, true, List.of("admin")); + project = this.generatorUpdate("organizationId", null, null, null, true, List.of("admin")); this.requestPost(updateProject, project, BAD_REQUEST_MATCHER); //项目名称为空 - project = this.generatorUpdate("organizationId", "projectId",null, null, true, List.of("admin")); + project = this.generatorUpdate("organizationId", "projectId", null, null, true, List.of("admin")); this.requestPost(updateProject, project, BAD_REQUEST_MATCHER); //项目不存在 - project = this.generatorUpdate("organizationId", "1111","123", null, true, List.of("admin")); + project = this.generatorUpdate("organizationId", "1111", "123", null, true, List.of("admin")); this.requestPost(updateProject, project, ERROR_REQUEST_MATCHER); } @@ -319,15 +319,19 @@ public class ProjectControllerTests extends BaseTest { @Test @Order(9) public void testGetPoolOptions() throws Exception { - MvcResult mvcResult = this.responseGet(getPoolOptions + ModuleType.API_TEST + "/"+DEFAULT_PROJECT_ID); - mvcResult = this.responseGet(getPoolOptions + ModuleType.UI_TEST + "/"+DEFAULT_PROJECT_ID); - mvcResult = this.responseGet(getPoolOptions + ModuleType.LOAD_TEST + "/"+DEFAULT_PROJECT_ID); - mvcResult = this.responseGet(getPoolOptions + "test" + "/"+DEFAULT_PROJECT_ID); + MvcResult mvcResult = this.responseGet(getPoolOptions + ModuleType.API_TEST + "/" + DEFAULT_PROJECT_ID); + mvcResult = this.responseGet(getPoolOptions + ModuleType.UI_TEST + "/" + DEFAULT_PROJECT_ID); + mvcResult = this.responseGet(getPoolOptions + ModuleType.LOAD_TEST + "/" + DEFAULT_PROJECT_ID); + mvcResult = this.responseGet(getPoolOptions + "test" + "/" + DEFAULT_PROJECT_ID); List list = parseObjectFromMvcResult(mvcResult, List.class); //断言为空的list Assertions.assertEquals(0, list.size()); + mvcResult = this.responseGet(getPoolOptions + ModuleType.API_TEST + "/" + "projectId"); + mvcResult = this.responseGet(getPoolOptions + ModuleType.UI_TEST + "/" + "projectId"); + mvcResult = this.responseGet(getPoolOptions + ModuleType.LOAD_TEST + "/" + "projectId"); + //权限校验 - requestGetPermissionTest(PermissionConstants.PROJECT_BASE_INFO_READ, getPoolOptions + "api_test" + "/"+DEFAULT_PROJECT_ID); + requestGetPermissionTest(PermissionConstants.PROJECT_BASE_INFO_READ, getPoolOptions + "api_test" + "/" + DEFAULT_PROJECT_ID); } diff --git a/backend/services/system-setting/src/test/resources/dml/init_org_project.sql b/backend/services/system-setting/src/test/resources/dml/init_org_project.sql index 244289b8a2..bcd7484ac6 100644 --- a/backend/services/system-setting/src/test/resources/dml/init_org_project.sql +++ b/backend/services/system-setting/src/test/resources/dml/init_org_project.sql @@ -41,4 +41,5 @@ replace into test_resource_pool(id, name, type, description, enable, create_time values ('resourcePoolId1', 'resourcePoolName1', 'node', 'resourcePoolDescription', 1, unix_timestamp() * 1000, unix_timestamp() * 1000, 'admin', 1, 1, 1, 'http://localhost:8080', 1, 0); replace into project_test_resource_pool(project_id, test_resource_pool_id) value ('projectId', 'resourcePoolId'); -replace into project_test_resource_pool(project_id, test_resource_pool_id) value ('projectId', 'resourcePoolId1'); \ No newline at end of file +replace into project_test_resource_pool(project_id, test_resource_pool_id) value ('projectId', 'resourcePoolId1'); +replace into test_resource_pool_organization(id , test_resource_pool_id, org_id) value (UUID_SHORT(),'resourcePoolId', '100001'); \ No newline at end of file diff --git a/backend/services/system-setting/src/test/resources/dml/init_project.sql b/backend/services/system-setting/src/test/resources/dml/init_project.sql index 0d2401caeb..d5140c8a5f 100644 --- a/backend/services/system-setting/src/test/resources/dml/init_project.sql +++ b/backend/services/system-setting/src/test/resources/dml/init_project.sql @@ -65,4 +65,5 @@ replace into test_resource_pool(id, name, type, description, enable, create_time values ('resourcePoolId1', 'resourcePoolName1', 'node', 'resourcePoolDescription', 1, unix_timestamp() * 1000, unix_timestamp() * 1000, 'admin', 1, 1, 1, 'http://localhost:8080', 1, 0); replace into project_test_resource_pool(project_id, test_resource_pool_id) value ('projectId', 'resourcePoolId'); -replace into project_test_resource_pool(project_id, test_resource_pool_id) value ('projectId', 'resourcePoolId1'); \ No newline at end of file +replace into project_test_resource_pool(project_id, test_resource_pool_id) value ('projectId', 'resourcePoolId1'); +replace into test_resource_pool_organization(id , test_resource_pool_id, org_id) value (UUID_SHORT(),'resourcePoolId', '100001'); \ No newline at end of file