Documentation
¶
Index ¶
- func CreateMockRegistration(t *testing.T, name string, cf func(o *device.CreateOptions) usb.Device, ...) api.DeviceRegistration
- func ExecCmd(t *testing.T, addr string, cmd string) string
- func ExecuteLine(t *testing.T, r *api.Router, data string) string
- func StartAPIServer(t *testing.T, register func(r *api.Router, s *usb.Server, apiSrv *api.Server)) (addr string, srv *usb.Server, done func())
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateMockRegistration ¶
func CreateMockRegistration( t *testing.T, name string, cf func(o *device.CreateOptions) usb.Device, h api.StreamHandlerFunc, ) api.DeviceRegistration
func ExecCmd ¶
ExecCmd dials the API server, sends cmd and reads the full response. The command should not include a trailing newline. Returns the response without the trailing newline.
func ExecuteLine ¶
ExecuteLine routes a command string through the provided router, emulating ApiServer.handleConn logic but without network IO. The data parameter is the full request data (path + optional payload). Returns the full response as produced by the API contract.
func StartAPIServer ¶
func StartAPIServer(t *testing.T, register func(r *api.Router, s *usb.Server, apiSrv *api.Server)) (addr string, srv *usb.Server, done func())
StartAPIServer starts an API server on a free port and calls register to allow the caller to register the handlers needed for the test. Returns the address and a function to call when done.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.