rename method to endpoint
This commit is contained in:
		| @@ -16,7 +16,7 @@ var ( | ||||
| ) | ||||
|  | ||||
| type MockResponse struct { | ||||
| 	Method   string | ||||
| 	Endpoint string | ||||
| 	Response interface{} | ||||
| 	Error    error | ||||
| } | ||||
| @@ -54,8 +54,8 @@ func (m *MockClient) NewMessage(topic string, msg interface{}, opts ...client.Me | ||||
| 	return m.Client.NewMessage(topic, msg, opts...) | ||||
| } | ||||
|  | ||||
| func (m *MockClient) NewRequest(service, method string, req interface{}, reqOpts ...client.RequestOption) client.Request { | ||||
| 	return m.Client.NewRequest(service, method, req, reqOpts...) | ||||
| func (m *MockClient) NewRequest(service, endpoint string, req interface{}, reqOpts ...client.RequestOption) client.Request { | ||||
| 	return m.Client.NewRequest(service, endpoint, req, reqOpts...) | ||||
| } | ||||
|  | ||||
| func (m *MockClient) Call(ctx context.Context, req client.Request, rsp interface{}, opts ...client.CallOption) error { | ||||
| @@ -68,7 +68,7 @@ func (m *MockClient) Call(ctx context.Context, req client.Request, rsp interface | ||||
| 	} | ||||
|  | ||||
| 	for _, r := range response { | ||||
| 		if r.Method != req.Method() { | ||||
| 		if r.Endpoint != req.Endpoint() { | ||||
| 			continue | ||||
| 		} | ||||
|  | ||||
| @@ -91,7 +91,7 @@ func (m *MockClient) Call(ctx context.Context, req client.Request, rsp interface | ||||
| 		return nil | ||||
| 	} | ||||
|  | ||||
| 	return fmt.Errorf("rpc: can't find service %s", req.Method()) | ||||
| 	return fmt.Errorf("rpc: can't find service %s", req.Endpoint()) | ||||
| } | ||||
|  | ||||
| func (m *MockClient) Stream(ctx context.Context, req client.Request, opts ...client.CallOption) (client.Stream, error) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user