diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 886087eed7..07312c603a 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -26,3 +26,5 @@ jobs: run: mvn -B package --file pom.xml - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/UserController.java b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/UserController.java index 824d8a8405..b77c0374a0 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/UserController.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/UserController.java @@ -5,6 +5,7 @@ import io.metersphere.domain.User; import io.metersphere.sdk.UserService; import jakarta.annotation.Resource; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -20,4 +21,9 @@ public class UserController { public List listAll() { return userService.list(); } + + @GetMapping("/get/{userId}") + public User getUser(@PathVariable String userId) { + return userService.getById(userId); + } } diff --git a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/UserControllerTests.java b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/UserControllerTests.java index 46eb95a74b..cb9282493b 100644 --- a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/UserControllerTests.java +++ b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/UserControllerTests.java @@ -28,4 +28,13 @@ public class UserControllerTests { .andDo(print()); } + @Test + public void testSelectAll2() throws Exception { + mockMvc.perform(MockMvcRequestBuilders.get("/user/get/admin")) + .andExpect(status().isOk()) +// .andExpect(content().contentType(MediaType.APPLICATION_JSON)) +// .andExpect(jsonPath("$.person.name").value("Jason")) + .andDo(print()); + } + }