MCPcopy Create free account
hub / github.com/Vespa314/cflow / getCurrentUser

Method getCurrentUser

test/server/user_test.go:44–61  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

42}
43
44func (s *TestingServer) getCurrentUser() (*apiv1.User, error) {
45 body, err := s.get("/api/v1/user/me", nil)
46 if err != nil {
47 return nil, err
48 }
49
50 buf := &bytes.Buffer{}
51 _, err = buf.ReadFrom(body)
52 if err != nil {
53 return nil, errors.Wrap(err, "fail to read response body")
54 }
55
56 user := &apiv1.User{}
57 if err = json.Unmarshal(buf.Bytes(), &user); err != nil {
58 return nil, errors.Wrap(err, "fail to unmarshal get user response")
59 }
60 return user, nil
61}
62
63func (s *TestingServer) getUserByID(userID int32) (*apiv1.User, error) {
64 body, err := s.get(fmt.Sprintf("/api/v1/user/%d", userID), nil)

Callers 2

TestUserServerFunction · 0.95
TestAuthServerFunction · 0.95

Calls 1

getMethod · 0.95

Tested by

no test coverage detected