diff --git a/internal/processor/test/free-d-create_test.go b/internal/processor/test/free-d-create_test.go index 7bedfc7..0afafe6 100644 --- a/internal/processor/test/free-d-create_test.go +++ b/internal/processor/test/free-d-create_test.go @@ -392,6 +392,151 @@ func TestBadFreeDCreate(t *testing.T) { errorString: "freed.create focus error: not a string", payload: nil, }, + + { + name: "id template syntax error", + params: map[string]any{ + "id": "{{", + "pan": "180", + "tilt": "90", + "roll": "-180", + "posX": "131069", + "posY": "131070", + "posZ": "131071", + "zoom": "66051", + "focus": "263430", + }, + errorString: "template: id:1: unclosed action", + payload: nil, + }, + { + name: "pan template syntax error", + params: map[string]any{ + "id": "1", + "pan": "{{", + "tilt": "90", + "roll": "-180", + "posX": "131069", + "posY": "131070", + "posZ": "131071", + "zoom": "66051", + "focus": "263430", + }, + errorString: "template: pan:1: unclosed action", + payload: nil, + }, + { + name: "tilt template syntax error", + params: map[string]any{ + "id": "1", + "pan": "180", + "tilt": "{{", + "roll": "-180", + "posX": "131069", + "posY": "131070", + "posZ": "131071", + "zoom": "66051", + "focus": "263430", + }, + errorString: "template: tilt:1: unclosed action", + payload: nil, + }, + { + name: "roll template syntax error", + params: map[string]any{ + "id": "1", + "pan": "180", + "tilt": "90", + "roll": "{{", + "posX": "131069", + "posY": "131070", + "posZ": "131071", + "zoom": "66051", + "focus": "263430", + }, + errorString: "template: roll:1: unclosed action", + payload: nil, + }, + { + name: "posX template syntax error", + params: map[string]any{ + "id": "1", + "pan": "180", + "tilt": "90", + "roll": "-180", + "posX": "{{", + "posY": "131070", + "posZ": "131071", + "zoom": "66051", + "focus": "263430", + }, + errorString: "template: posX:1: unclosed action", + payload: nil, + }, + { + name: "posY template syntax error", + params: map[string]any{ + "id": "1", + "pan": "180", + "tilt": "90", + "roll": "-180", + "posX": "131069", + "posY": "{{", + "posZ": "131071", + "zoom": "66051", + "focus": "263430", + }, + errorString: "template: posY:1: unclosed action", + payload: nil, + }, + { + name: "posZ template syntax error", + params: map[string]any{ + "id": "1", + "pan": "180", + "tilt": "90", + "roll": "-180", + "posX": "131069", + "posY": "131070", + "posZ": "{{", + "zoom": "66051", + "focus": "263430", + }, + errorString: "template: posZ:1: unclosed action", + payload: nil, + }, + { + name: "zoom template syntax error", + params: map[string]any{ + "id": "1", + "pan": "180", + "tilt": "90", + "roll": "-180", + "posX": "131069", + "posY": "131070", + "posZ": "131071", + "zoom": "{{", + "focus": "263430", + }, + errorString: "template: zoom:1: unclosed action", + payload: nil, + }, + { + name: "focus template syntax error", + params: map[string]any{ + "id": "1", + "pan": "180", + "tilt": "90", + "roll": "-180", + "posX": "131069", + "posY": "131070", + "posZ": "131071", + "zoom": "66051", + "focus": "{{", + }, + errorString: "template: focus:1: unclosed action", + payload: nil, + }, { name: "id template error", params: map[string]any{ @@ -536,6 +681,168 @@ func TestBadFreeDCreate(t *testing.T) { errorString: "template: focus:1:2: executing \"focus\" at <.Unknown>: can't evaluate field Unknown in type common.WrappedPayload", payload: nil, }, + { + name: "id number parsing error", + params: map[string]any{ + "id": "{{.Payload.id}}", + "pan": "180", + "tilt": "90", + "roll": "-180", + "posX": "131069", + "posY": "131070", + "posZ": "131071", + "zoom": "66051", + "focus": "263430", + }, + payload: map[string]any{ + "id": "not a number", + }, + errorString: "strconv.ParseUint: parsing \"not a number\": invalid syntax", + }, + { + name: "pan number parsing error", + params: map[string]any{ + "id": "1", + "pan": "{{.Payload.pan}}", + "tilt": "90", + "roll": "-180", + "posX": "131069", + "posY": "131070", + "posZ": "131071", + "zoom": "66051", + "focus": "263430", + }, + payload: map[string]any{ + "pan": "not a number", + }, + errorString: "strconv.ParseFloat: parsing \"not a number\": invalid syntax", + }, + { + name: "tilt number parsing error", + params: map[string]any{ + "id": "1", + "pan": "180", + "tilt": "{{.Payload.tilt}}", + "roll": "-180", + "posX": "131069", + "posY": "131070", + "posZ": "131071", + "zoom": "66051", + "focus": "263430", + }, + payload: map[string]any{ + "tilt": "not a number", + }, + errorString: "strconv.ParseFloat: parsing \"not a number\": invalid syntax", + }, + { + name: "roll number parsing error", + params: map[string]any{ + "id": "1", + "pan": "180", + "tilt": "90", + "roll": "{{.Payload.roll}}", + "posX": "131069", + "posY": "131070", + "posZ": "131071", + "zoom": "66051", + "focus": "263430", + }, + payload: map[string]any{ + "roll": "not a number", + }, + errorString: "strconv.ParseFloat: parsing \"not a number\": invalid syntax", + }, + { + name: "posX number parsing error", + params: map[string]any{ + "id": "1", + "pan": "180", + "tilt": "90", + "roll": "-180", + "posX": "{{.Payload.posX}}", + "posY": "131070", + "posZ": "131071", + "zoom": "66051", + "focus": "263430", + }, + payload: map[string]any{ + "posX": "not a number", + }, + errorString: "strconv.ParseFloat: parsing \"not a number\": invalid syntax", + }, + { + name: "posY number parsing error", + params: map[string]any{ + "id": "1", + "pan": "180", + "tilt": "90", + "roll": "-180", + "posX": "131069", + "posY": "{{.Payload.posY}}", + "posZ": "131071", + "zoom": "66051", + "focus": "263430", + }, + payload: map[string]any{ + "posY": "not a number", + }, + errorString: "strconv.ParseFloat: parsing \"not a number\": invalid syntax", + }, + { + name: "posZ number parsing error", + params: map[string]any{ + "id": "1", + "pan": "180", + "tilt": "90", + "roll": "-180", + "posX": "131069", + "posY": "131070", + "posZ": "{{.Payload.posZ}}", + "zoom": "66051", + "focus": "263430", + }, + payload: map[string]any{ + "posZ": "not a number", + }, + errorString: "strconv.ParseFloat: parsing \"not a number\": invalid syntax", + }, + { + name: "zoom number parsing error", + params: map[string]any{ + "id": "1", + "pan": "180", + "tilt": "90", + "roll": "-180", + "posX": "131069", + "posY": "131070", + "posZ": "131071", + "zoom": "{{.Payload.zoom}}", + "focus": "263430", + }, + payload: map[string]any{ + "zoom": "not a number", + }, + errorString: "strconv.ParseInt: parsing \"not a number\": invalid syntax", + }, + { + name: "focus number parsing error", + params: map[string]any{ + "id": "1", + "pan": "180", + "tilt": "90", + "roll": "-180", + "posX": "131069", + "posY": "131070", + "posZ": "131071", + "zoom": "66051", + "focus": "{{.Payload.focus}}", + }, + payload: map[string]any{ + "focus": "not a number", + }, + errorString: "strconv.ParseInt: parsing \"not a number\": invalid syntax", + }, } for _, test := range tests {