feat(netxmocks): implement mocks for netxlite.Resolver (#398)
While there, make sure we require using &netxmocks.Dialer. Still part of https://github.com/ooni/probe/issues/1505
This commit is contained in:
parent
16aa8e5538
commit
c5dd9a68f1
9 changed files with 96 additions and 16 deletions
|
|
@ -14,7 +14,7 @@ import (
|
|||
func TestProxyDialerDialContextNoProxyURL(t *testing.T) {
|
||||
expected := errors.New("mocked error")
|
||||
d := &proxyDialer{
|
||||
Dialer: netxmocks.Dialer{
|
||||
Dialer: &netxmocks.Dialer{
|
||||
MockDialContext: func(ctx context.Context, network string, address string) (net.Conn, error) {
|
||||
return nil, expected
|
||||
},
|
||||
|
|
@ -45,7 +45,7 @@ func TestProxyDialerDialContextInvalidScheme(t *testing.T) {
|
|||
func TestProxyDialerDialContextWithEOF(t *testing.T) {
|
||||
const expect = "10.0.0.1:9050"
|
||||
d := &proxyDialer{
|
||||
Dialer: netxmocks.Dialer{
|
||||
Dialer: &netxmocks.Dialer{
|
||||
MockDialContext: func(ctx context.Context, network string, address string) (net.Conn, error) {
|
||||
if address != expect {
|
||||
return nil, errors.New("unexpected address")
|
||||
|
|
|
|||
Loading…
Reference in a new issue