Documentation ¶
Index ¶
- type HTTPTest
- type MessageClient
- type SubscriptionDetails
- type ThingsHTTPRequest
- func (r *ThingsHTTPRequest) Delete() *ThingsHTTPRequest
- func (r *ThingsHTTPRequest) Execute() ([]byte, error)
- func (r *ThingsHTTPRequest) Feature(featureID string) *ThingsHTTPRequest
- func (r *ThingsHTTPRequest) Get() *ThingsHTTPRequest
- func (r *ThingsHTTPRequest) Put(data interface{}) *ThingsHTTPRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPTest ¶
type HTTPTest struct { Subscription *SubscriptionDetails // contains filtered or unexported fields }
HTTPTest is a structure used for automatic setup and creation of http related tests.
func (*HTTPTest) NewThingsRequest ¶
func (t *HTTPTest) NewThingsRequest(deviceID string) *ThingsHTTPRequest
NewThingsRequest returns a new ThingsHTTPRequest.
type MessageClient ¶
type MessageClient struct { Subscription *SubscriptionDetails MessagesCh <-chan *message.Message Pub message.Publisher Sub message.Subscriber Connection *connector.MQTTConnection // contains filtered or unexported fields }
MessageClient contains the testing messaging related data.
func NewMessageClient ¶
func NewMessageClient(t *testing.T) (*MessageClient, error)
NewMessageClient returns a new MessageClient with an initialized testutil.SubscriptionDetails, local MQTT connection and publisher.
func (*MessageClient) Publish ¶
func (c *MessageClient) Publish(pubTopic string, data []byte) error
Publish creates a new message.Message and publishes it using the client publisher.
func (*MessageClient) WithSub ¶
func (c *MessageClient) WithSub(thingNames ...string) (*MessageClient, error)
WithSub initializes the client subscriber and message channel. The thing names are used to build the things` model.NamespacedID and subscription topic.
type SubscriptionDetails ¶
type SubscriptionDetails struct { GrantType string `json:"grantType,omitempty"` ClientID string `json:"clientId,omitempty"` ClientSecret string `json:"clientSecret,omitempty"` ClientScopeThings string `json:"clientScopeThings,omitempty"` Namespace string `json:"namespace,omitempty"` DeviceName string `json:"deviceName,omitempty"` TenantID string `json:"tenantId,omitempty"` }
SubscriptionDetails is used in multiple test files.
type ThingsHTTPRequest ¶
type ThingsHTTPRequest struct {
// contains filtered or unexported fields
}
ThingsHTTPRequest represents an HTTP request used to retrieve or manipulate remote thing data.
func (*ThingsHTTPRequest) Delete ¶
func (r *ThingsHTTPRequest) Delete() *ThingsHTTPRequest
Delete sets the value of the method of r to "DELETE".
func (*ThingsHTTPRequest) Execute ¶
func (r *ThingsHTTPRequest) Execute() ([]byte, error)
Execute creates a new http.Request using the data from r and executes it using a http.Client. Returns the body of the received http.Response.
func (*ThingsHTTPRequest) Feature ¶
func (r *ThingsHTTPRequest) Feature(featureID string) *ThingsHTTPRequest
Feature sets the relative path of r using featureID to refer to the specified feature.
func (*ThingsHTTPRequest) Get ¶
func (r *ThingsHTTPRequest) Get() *ThingsHTTPRequest
Get sets the value of the method of r to "GET".
func (*ThingsHTTPRequest) Put ¶
func (r *ThingsHTTPRequest) Put(data interface{}) *ThingsHTTPRequest
Put sets the value of the method of r to "PUT".