forked from irinazheltisheva/powergate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmocks.go
More file actions
44 lines (34 loc) · 1 KB
/
mocks.go
File metadata and controls
44 lines (34 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package mocks
import (
"context"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/multiformats/go-multiaddr"
minerModule "github.com/textileio/powergate/index/miner/module"
"github.com/textileio/powergate/iplocation"
)
var _ minerModule.P2PHost = (*P2pHostMock)(nil)
// P2pHostMock provides a mock P2PHost.
type P2pHostMock struct{}
// Addrs implements Addrs.
func (hm *P2pHostMock) Addrs(id peer.ID) []multiaddr.Multiaddr {
return nil
}
// GetAgentVersion implements GetAgentVersion.
func (hm *P2pHostMock) GetAgentVersion(id peer.ID) string {
return "fakeAgentVersion"
}
// Ping implements Ping.
func (hm *P2pHostMock) Ping(ctx context.Context, pid peer.ID) bool {
return true
}
var _ iplocation.LocationResolver = (*LrMock)(nil)
// LrMock provides a mock LocationResolver.
type LrMock struct{}
// Resolve implements Resolve.
func (lr *LrMock) Resolve(mas []multiaddr.Multiaddr) (iplocation.Location, error) {
return iplocation.Location{
Country: "USA",
Latitude: 0.1,
Longitude: 0.1,
}, nil
}