mirror of
https://github.com/netbirdio/netbird.git
synced 2025-06-24 19:51:33 +02:00
add method to account mock
This commit is contained in:
parent
b8cab2882b
commit
453643683d
@ -47,6 +47,7 @@ type MockAccountManager struct {
|
|||||||
DeletePolicyFunc func(accountID, policyID, userID string) error
|
DeletePolicyFunc func(accountID, policyID, userID string) error
|
||||||
ListPoliciesFunc func(accountID, userID string) ([]*server.Policy, error)
|
ListPoliciesFunc func(accountID, userID string) ([]*server.Policy, error)
|
||||||
GetUsersFromAccountFunc func(accountID, userID string) ([]*server.UserInfo, error)
|
GetUsersFromAccountFunc func(accountID, userID string) ([]*server.UserInfo, error)
|
||||||
|
GetAccountFromPATFunc func(pat string) (*server.Account, *server.User, error)
|
||||||
UpdatePeerMetaFunc func(peerID string, meta server.PeerSystemMeta) error
|
UpdatePeerMetaFunc func(peerID string, meta server.PeerSystemMeta) error
|
||||||
UpdatePeerSSHKeyFunc func(peerID string, sshKey string) error
|
UpdatePeerSSHKeyFunc func(peerID string, sshKey string) error
|
||||||
UpdatePeerFunc func(accountID, userID string, peer *server.Peer) (*server.Peer, error)
|
UpdatePeerFunc func(accountID, userID string, peer *server.Peer) (*server.Peer, error)
|
||||||
@ -175,6 +176,14 @@ func (am *MockAccountManager) GetPeerByIP(accountId string, peerIP string) (*ser
|
|||||||
return nil, status.Errorf(codes.Unimplemented, "method GetPeerByIP is not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method GetPeerByIP is not implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetAccountFromPAT mock implementation of GetAccountFromPAT from server.AccountManager interface
|
||||||
|
func (am *MockAccountManager) GetAccountFromPAT(pat string) (*server.Account, *server.User, error) {
|
||||||
|
if am.GetAccountFromPATFunc != nil {
|
||||||
|
return am.GetAccountFromPATFunc(pat)
|
||||||
|
}
|
||||||
|
return nil, nil, status.Errorf(codes.Unimplemented, "method GetAccountFromPAT is not implemented")
|
||||||
|
}
|
||||||
|
|
||||||
// GetNetworkMap mock implementation of GetNetworkMap from server.AccountManager interface
|
// GetNetworkMap mock implementation of GetNetworkMap from server.AccountManager interface
|
||||||
func (am *MockAccountManager) GetNetworkMap(peerKey string) (*server.NetworkMap, error) {
|
func (am *MockAccountManager) GetNetworkMap(peerKey string) (*server.NetworkMap, error) {
|
||||||
if am.GetNetworkMapFunc != nil {
|
if am.GetNetworkMapFunc != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user