You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think mocking would be a great feature to support, so we'll discuss it internally.
My only hesitation would be about breaking changes. We'll need the freedom to make changes to the structure of the RequestConfig type. But we could replace RequestConfig with an interface, like so
type RequestOption = func(*requestconfig.RequestConfig) error
type RequestOption = func(option.RequestConfigurable) error
type RequestConfigurable interface {
SetTimeout(time.Duration)
// ...
}
However, it could break your mocking program every time we add an option. Then again, perhaps that's better than not being able to mock at all.
Instead of making everything mockable, maybe we could be inspired by net/http/httptest.Server.Client? This returns an *http.Client which is wired up to a test server.
Hi there, thanks for the library. Looking forward to beta.
One thing I noticed with the current version is it is difficult to mock the api using mockgen. The RequestOption accepted by the methods I'd like to mock makes use of internal types: https://github.com/openai/openai-go/blob/main/option/requestoption.go#L23
Would it be possible to make sure these interfaces are fully public so we can mock them out in tests?
Thanks!
The text was updated successfully, but these errors were encountered: