mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-04 05:16:23 +08:00
commands: Fixed tests
This commit is contained in:
@ -17,21 +17,21 @@ func TestOptionValidation(t *testing.T) {
|
||||
|
||||
opts, _ := cmd.GetOptions(nil)
|
||||
|
||||
req := NewRequest(nil, nil, nil, nil, opts)
|
||||
req, _ := NewRequest(nil, nil, nil, nil, opts)
|
||||
req.SetOption("beep", true)
|
||||
res := cmd.Call(req)
|
||||
if res.Error() == nil {
|
||||
t.Error("Should have failed (incorrect type)")
|
||||
}
|
||||
|
||||
req = NewRequest(nil, nil, nil, nil, opts)
|
||||
req, _ = NewRequest(nil, nil, nil, nil, opts)
|
||||
req.SetOption("beep", 5)
|
||||
res = cmd.Call(req)
|
||||
if res.Error() != nil {
|
||||
t.Error(res.Error(), "Should have passed")
|
||||
}
|
||||
|
||||
req = NewRequest(nil, nil, nil, nil, opts)
|
||||
req, _ = NewRequest(nil, nil, nil, nil, opts)
|
||||
req.SetOption("beep", 5)
|
||||
req.SetOption("boop", "test")
|
||||
res = cmd.Call(req)
|
||||
@ -39,7 +39,7 @@ func TestOptionValidation(t *testing.T) {
|
||||
t.Error("Should have passed")
|
||||
}
|
||||
|
||||
req = NewRequest(nil, nil, nil, nil, opts)
|
||||
req, _ = NewRequest(nil, nil, nil, nil, opts)
|
||||
req.SetOption("b", 5)
|
||||
req.SetOption("B", "test")
|
||||
res = cmd.Call(req)
|
||||
@ -47,28 +47,28 @@ func TestOptionValidation(t *testing.T) {
|
||||
t.Error("Should have passed")
|
||||
}
|
||||
|
||||
req = NewRequest(nil, nil, nil, nil, opts)
|
||||
req, _ = NewRequest(nil, nil, nil, nil, opts)
|
||||
req.SetOption("foo", 5)
|
||||
res = cmd.Call(req)
|
||||
if res.Error() != nil {
|
||||
t.Error("Should have passed")
|
||||
}
|
||||
|
||||
req = NewRequest(nil, nil, nil, nil, opts)
|
||||
req, _ = NewRequest(nil, nil, nil, nil, opts)
|
||||
req.SetOption(EncShort, "json")
|
||||
res = cmd.Call(req)
|
||||
if res.Error() != nil {
|
||||
t.Error("Should have passed")
|
||||
}
|
||||
|
||||
req = NewRequest(nil, nil, nil, nil, opts)
|
||||
req, _ = NewRequest(nil, nil, nil, nil, opts)
|
||||
req.SetOption("b", "100")
|
||||
res = cmd.Call(req)
|
||||
if res.Error() != nil {
|
||||
t.Error("Should have passed")
|
||||
}
|
||||
|
||||
req = NewRequest(nil, nil, nil, nil, opts)
|
||||
req, _ = NewRequest(nil, nil, nil, nil, opts)
|
||||
req.SetOption("b", ":)")
|
||||
res = cmd.Call(req)
|
||||
if res.Error() == nil {
|
||||
|
Reference in New Issue
Block a user