auth yay!

This commit is contained in:
41666 2025-03-26 22:28:20 -07:00
parent a3a1654030
commit c50bfc1a7f
9 changed files with 339 additions and 110 deletions

View file

@ -46,7 +46,7 @@ func (c *DiscordClientMock) ClientAuth(req *http.Request, accessToken string) {
c.Called(req, accessToken)
}
func (c *DiscordClientMock) MockResponse(method, path string, statusCode int, data any) {
func (c *DiscordClientMock) MockResponse(method, path string, statusCode int, data any) *mock.Call {
body := bytes.Buffer{}
json.NewEncoder(&body).Encode(data)
@ -57,7 +57,7 @@ func (c *DiscordClientMock) MockResponse(method, path string, statusCode int, da
pathMatcher := regexp.MustCompile(strings.ReplaceAll(path, "*", "[a-z0-9_-]+"))
c.On("Do", mock.MatchedBy(func(req *http.Request) bool {
return c.On("Do", mock.MatchedBy(func(req *http.Request) bool {
return req.Method == method && pathMatcher.MatchString(req.URL.Path)
})).Return(r, nil)
}