cleanup(jafar): do not depend on netx and urlgetter (#792)
There's no point in doing that. Also, once this change is merged, it becomes easier to cleanup/simplify netx. See https://github.com/ooni/probe/issues/2121
This commit is contained in:
parent
76b65893a1
commit
15da0f5344
19 changed files with 341 additions and 271 deletions
|
|
@ -16,6 +16,27 @@ import (
|
|||
"github.com/ooni/probe-cli/v3/internal/model/mocks"
|
||||
)
|
||||
|
||||
func TestNewHTTPTransportWithResolver(t *testing.T) {
|
||||
expected := errors.New("mocked error")
|
||||
reso := &mocks.Resolver{
|
||||
MockLookupHost: func(ctx context.Context, domain string) ([]string, error) {
|
||||
return nil, expected
|
||||
},
|
||||
}
|
||||
txp := NewHTTPTransportWithResolver(model.DiscardLogger, reso)
|
||||
req, err := http.NewRequest("GET", "http://x.org", nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
resp, err := txp.RoundTrip(req)
|
||||
if !errors.Is(err, expected) {
|
||||
t.Fatal("unexpected err")
|
||||
}
|
||||
if resp != nil {
|
||||
t.Fatal("expected nil resp")
|
||||
}
|
||||
}
|
||||
|
||||
func TestHTTPTransportErrWrapper(t *testing.T) {
|
||||
t.Run("RoundTrip", func(t *testing.T) {
|
||||
t.Run("with failure", func(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue