@cryptotaxi247 / kubo / commits / 4b0f44e44

commands: Fixed tests

Matt Bell committed Oct 15, 2014 at 17:01 UTC 4b0f44e441d774ecd71b43542a06918131b92674
2 files changed +10 -10
commands/command_test.go
+9 -9
@@ -11,14 +11,14 @@ func TestOptionValidation(t *testing.T) {
11 f: func(req *Request, res *Response) {},
12 }
13
14 - req := NewRequest()
14 + req := NewEmptyRequest()
15 req.options["foo"] = 5
16 res := cmd.Call(req)
17 if res.Error == nil {
18 t.Error("Should have failed (unrecognized option)")
19 }
20
21 - req = NewRequest()
21 + req = NewEmptyRequest()
22 req.options["beep"] = 5
23 req.options["b"] = 10
24 res = cmd.Call(req)
@@ -26,21 +26,21 @@ func TestOptionValidation(t *testing.T) {
26 t.Error("Should have failed (duplicate options)")
27 }
28
29 - req = NewRequest()
29 + req = NewEmptyRequest()
30 req.options["beep"] = "foo"
31 res = cmd.Call(req)
32 if res.Error == nil {
33 t.Error("Should have failed (incorrect type)")
34 }
35
36 - req = NewRequest()
36 + req = NewEmptyRequest()
37 req.options["beep"] = 5
38 res = cmd.Call(req)
39 if res.Error != nil {
40 t.Error(res.Error, "Should have passed")
41 }
42
43 - req = NewRequest()
43 + req = NewEmptyRequest()
44 req.options["beep"] = 5
45 req.options["boop"] = "test"
46 res = cmd.Call(req)
@@ -48,7 +48,7 @@ func TestOptionValidation(t *testing.T) {
48 t.Error("Should have passed")
49 }
50
51 - req = NewRequest()
51 + req = NewEmptyRequest()
52 req.options["b"] = 5
53 req.options["B"] = "test"
54 res = cmd.Call(req)
@@ -56,21 +56,21 @@ func TestOptionValidation(t *testing.T) {
56 t.Error("Should have passed")
57 }
58
59 - req = NewRequest()
59 + req = NewEmptyRequest()
60 req.options["enc"] = "json"
61 res = cmd.Call(req)
62 if res.Error != nil {
63 t.Error("Should have passed")
64 }
65
66 - req = NewRequest()
66 + req = NewEmptyRequest()
67 req.options["b"] = "100"
68 res = cmd.Call(req)
69 if res.Error != nil {
70 t.Error("Should have passed")
71 }
72
73 - req = NewRequest()
73 + req = NewEmptyRequest()
74 req.options["b"] = ":)"
75 res = cmd.Call(req)
76 if res.Error == nil {
commands/response_test.go
+1 -1
@@ -11,7 +11,7 @@ type TestOutput struct {
11 }
12
13 func TestMarshalling(t *testing.T) {
14 - req := NewRequest()
14 + req := NewEmptyRequest()
15
16 res := Response{
17 req: req,