mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 16:54:02 +03:00
FILE / ScuroNeko/mtg
network/init_internal_test.go
Исходный файл и его история в репозитории.
25 lines
511 B
Go
25 lines
511 B
Go
package network
|
|
|
|
import (
|
|
"context"
|
|
"net"
|
|
|
|
"github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
type DialerMock struct {
|
|
mock.Mock
|
|
}
|
|
|
|
func (d *DialerMock) Dial(network, address string) (net.Conn, error) {
|
|
args := d.Called(network, address)
|
|
|
|
return args.Get(0).(net.Conn), args.Error(1) // nolint: wrapcheck
|
|
}
|
|
|
|
func (d *DialerMock) DialContext(ctx context.Context, network, address string) (net.Conn, error) {
|
|
args := d.Called(ctx, network, address)
|
|
|
|
return args.Get(0).(net.Conn), args.Error(1) // nolint: wrapcheck
|
|
}
|