mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 22:24:02 +03:00
Add antireplay cache mock
This commit is contained in:
@@ -0,0 +1,11 @@
|
|||||||
|
package testlib
|
||||||
|
|
||||||
|
import "github.com/stretchr/testify/mock"
|
||||||
|
|
||||||
|
type MtglibAntiReplayCacheMock struct {
|
||||||
|
mock.Mock
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MtglibAntiReplayCacheMock) SeenBefore(data []byte) bool {
|
||||||
|
return m.Called(data).Bool(0)
|
||||||
|
}
|
||||||
@@ -13,14 +13,14 @@ type MtglibNetworkMock struct {
|
|||||||
mock.Mock
|
mock.Mock
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *MtglibNetworkMock) Dial(network, address string) (net.Conn, error) {
|
func (m *MtglibNetworkMock) Dial(network, address string) (net.Conn, error) {
|
||||||
args := n.Called(network, address)
|
args := m.Called(network, address)
|
||||||
|
|
||||||
return args.Get(0).(net.Conn), args.Error(1)
|
return args.Get(0).(net.Conn), args.Error(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *MtglibNetworkMock) DialContext(ctx context.Context, network, address string) (net.Conn, error) {
|
func (m *MtglibNetworkMock) DialContext(ctx context.Context, network, address string) (net.Conn, error) {
|
||||||
args := n.Called(ctx, network, address)
|
args := m.Called(ctx, network, address)
|
||||||
|
|
||||||
return args.Get(0).(net.Conn), args.Error(1)
|
return args.Get(0).(net.Conn), args.Error(1)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user