refactor(oohelperd): improve tests implementation (#835)
After this diff has landed, we have addressed all the points originally published at https://github.com/ooni/probe/issues/2134.
This commit is contained in:
parent
535a5d3e00
commit
d419ed8ac8
7 changed files with 186 additions and 168 deletions
|
|
@ -9,6 +9,7 @@ import (
|
|||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/ooni/probe-cli/v3/internal/model"
|
||||
"github.com/ooni/probe-cli/v3/internal/model/mocks"
|
||||
"github.com/ooni/probe-cli/v3/internal/netxlite"
|
||||
)
|
||||
|
||||
|
|
@ -46,8 +47,13 @@ func TestHTTPDoWithHTTPTransportFailure(t *testing.T) {
|
|||
MaxAcceptableBody: 1 << 24,
|
||||
NewClient: func() model.HTTPClient {
|
||||
return &http.Client{
|
||||
Transport: FakeTransport{
|
||||
Err: expected,
|
||||
Transport: &mocks.HTTPTransport{
|
||||
MockRoundTrip: func(req *http.Request) (*http.Response, error) {
|
||||
return nil, expected
|
||||
},
|
||||
MockCloseIdleConnections: func() {
|
||||
// nothing
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue