commands: Added tests for Request#SetOptions
Matt Bell committed
Nov 18, 2014 at 01:24 UTC
8968b98cf356625440e44a24a4154a55795314f1
1 file changed
+15
-1
commands/command_test.go
+15
-1
@@ -68,12 +68,26 @@ func TestOptionValidation(t *testing.T) {
68
t.Error("Should have passed")
69
}
70
71
- req, _ = NewRequest(nil, nil, nil, nil, nil, opts)
71
+ req, _ = NewRequest(nil, nil, nil, nil, &cmd, opts)
72
req.SetOption("b", ":)")
73
res = cmd.Call(req)
74
if res.Error() == nil {
75
t.Error("Should have failed (string value not convertible to int)")
76
}
77
+
78
+ err := req.SetOptions(map[string]interface{}{
79
+ "b": 100,
80
+ })
81
+ if err != nil {
82
+ t.Error("Should have passed")
83
+ }
84
+
85
+ err = req.SetOptions(map[string]interface{}{
86
+ "b": ":)",
87
+ })
88
+ if err == nil {
89
+ t.Error("Should have failed (string value not convertible to int)")
90
+ }
91
}
92
93
func TestRegistration(t *testing.T) {