@cryptotaxi247 / kubo / commits / 3c5bfcec3

commands: Fixed tests

Matt Bell committed Nov 16, 2014 at 18:07 UTC 3c5bfcec316a2bb84779e02d8b804847a3c68256
2 files changed +9 -9
commands/command_test.go
+8 -8
@@ -17,21 +17,21 @@ func TestOptionValidation(t *testing.T) {
17
18 opts, _ := cmd.GetOptions(nil)
19
20 - req := NewRequest(nil, nil, nil, nil, opts)
20 + req, _ := NewRequest(nil, nil, nil, nil, opts)
21 req.SetOption("beep", true)
22 res := cmd.Call(req)
23 if res.Error() == nil {
24 t.Error("Should have failed (incorrect type)")
25 }
26
27 - req = NewRequest(nil, nil, nil, nil, opts)
27 + req, _ = NewRequest(nil, nil, nil, nil, opts)
28 req.SetOption("beep", 5)
29 res = cmd.Call(req)
30 if res.Error() != nil {
31 t.Error(res.Error(), "Should have passed")
32 }
33
34 - req = NewRequest(nil, nil, nil, nil, opts)
34 + req, _ = NewRequest(nil, nil, nil, nil, opts)
35 req.SetOption("beep", 5)
36 req.SetOption("boop", "test")
37 res = cmd.Call(req)
@@ -39,7 +39,7 @@ func TestOptionValidation(t *testing.T) {
39 t.Error("Should have passed")
40 }
41
42 - req = NewRequest(nil, nil, nil, nil, opts)
42 + req, _ = NewRequest(nil, nil, nil, nil, opts)
43 req.SetOption("b", 5)
44 req.SetOption("B", "test")
45 res = cmd.Call(req)
@@ -47,28 +47,28 @@ func TestOptionValidation(t *testing.T) {
47 t.Error("Should have passed")
48 }
49
50 - req = NewRequest(nil, nil, nil, nil, opts)
50 + req, _ = NewRequest(nil, nil, nil, nil, opts)
51 req.SetOption("foo", 5)
52 res = cmd.Call(req)
53 if res.Error() != nil {
54 t.Error("Should have passed")
55 }
56
57 - req = NewRequest(nil, nil, nil, nil, opts)
57 + req, _ = NewRequest(nil, nil, nil, nil, opts)
58 req.SetOption(EncShort, "json")
59 res = cmd.Call(req)
60 if res.Error() != nil {
61 t.Error("Should have passed")
62 }
63
64 - req = NewRequest(nil, nil, nil, nil, opts)
64 + req, _ = NewRequest(nil, nil, nil, nil, opts)
65 req.SetOption("b", "100")
66 res = cmd.Call(req)
67 if res.Error() != nil {
68 t.Error("Should have passed")
69 }
70
71 - req = NewRequest(nil, nil, nil, nil, opts)
71 + req, _ = NewRequest(nil, nil, nil, nil, opts)
72 req.SetOption("b", ":)")
73 res = cmd.Call(req)
74 if res.Error() == nil {
commands/response_test.go
+1 -1
@@ -15,7 +15,7 @@ func TestMarshalling(t *testing.T) {
15 cmd := &Command{}
16 opts, _ := cmd.GetOptions(nil)
17
18 - req := NewRequest(nil, nil, nil, nil, opts)
18 + req, _ := NewRequest(nil, nil, nil, nil, opts)
19
20 res := NewResponse(req)
21 res.SetOutput(TestOutput{"beep", "boop", 1337})