Documentation ¶
Index ¶
- Constants
- func Device(st *state.State) (*auth.DeviceState, error)
- func MarkInitialized(st *state.State)
- func MockDeviceService(c *C, bhv *DeviceServiceBehavior) (mockServer *httptest.Server, extraPemEncodedCerts []byte)
- func MockGadget(c *C, st *state.State, name string, revision snap.Revision, ...) (restore func())
- func SetDevice(st *state.State, device *auth.DeviceState) error
- type DeviceServiceBehavior
- type PrepareDeviceBehavior
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 MarkInitialized ¶
MarkInitialized flags the state as seeded and the device registered to avoid running the seeding code etc in tests, it also tries to sets the model to generic-classic. If the initial model is imporant this cannot be used.
func MockDeviceService ¶
func MockDeviceService(c *C, bhv *DeviceServiceBehavior) (mockServer *httptest.Server, extraPemEncodedCerts []byte)
func MockGadget ¶
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) }
Click to show internal directories.
Click to hide internal directories.