]> git.giacomolli.uk - onehouse/blob - protocol/builders_helper_test.go
Run explicit drivers with signal cancellation
[onehouse] / protocol / builders_helper_test.go
1 package protocol
2
3 import (
4 "encoding/json"
5 "time"
6 )
7
8 func testDescriptor() DescriptorPayload {
9 return DescriptorPayload{
10 Manufacturer: "example",
11 Model: "relay",
12 Firmware: "1",
13 Attribution: "source",
14 Capabilities: []Capability{{
15 ID: "relay",
16 Type: "switch",
17 ReportsState: true,
18 AcceptsCommands: true,
19 }},
20 }
21 }
22
23 func testBatch(deadline time.Time) BatchPayload {
24 return BatchPayload{Commands: []BatchCommand{
25 {
26 Metadata: Metadata{
27 MessageID: messageID,
28 ExpiresAt: &deadline,
29 },
30 Capability: "relay.1",
31 Payload: ValuePayload{Value: json.RawMessage(`true`)},
32 },
33 {
34 Metadata: Metadata{
35 MessageID: commandID,
36 ExpiresAt: &deadline,
37 },
38 Capability: "relay.2",
39 Payload: ValuePayload{Value: json.RawMessage(`false`)},
40 },
41 }}
42 }