devicestatetest

package
v0.0.0-...-115137c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2021 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReqIDFailID501          = "REQID-FAIL-ID-501"
	ReqIDBadRequest         = "REQID-BAD-REQ"
	ReqIDPoll               = "REQID-POLL"
	ReqIDSerialWithBadModel = "REQID-SERIAL-W-BAD-MODEL"
)

Request IDs for hard-coded behaviors.

Variables

This section is empty.

Functions

func Device

func Device(st *state.State) (*auth.DeviceState, error)

func MockDeviceService

func MockDeviceService(c *C, bhv *DeviceServiceBehavior) *httptest.Server

func MockGadget

func MockGadget(c *C, st *state.State, name string, revision snap.Revision, pDBhv *PrepareDeviceBehavior) (restore func())

func SetDevice

func SetDevice(st *state.State, device *auth.DeviceState) error

Types

type DeviceServiceBehavior

type DeviceServiceBehavior struct {
	ReqID string

	RequestIDURLPath     string
	SerialURLPath        string
	ExpectedCapabilities string

	Head          func(c *C, bhv *DeviceServiceBehavior, w http.ResponseWriter, r *http.Request)
	PostPreflight func(c *C, bhv *DeviceServiceBehavior, w http.ResponseWriter, r *http.Request)

	SignSerial func(c *C, bhv *DeviceServiceBehavior, headers map[string]interface{}, body []byte) (serial asserts.Assertion, ancillary []asserts.Assertion, err error)
}

type PrepareDeviceBehavior

type PrepareDeviceBehavior struct {
	DeviceSvcURL   string
	Headers        map[string]string
	RegBody        map[string]string
	ProposedSerial string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL