Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3-cmds
Commits
5681ad62
Commit
5681ad62
authored
Oct 14, 2014
by
Matt Bell
Committed by
Juan Batiz-Benet
Oct 20, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commands: Fixed tests
parent
122e71bf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
command_test.go
command_test.go
+2
-2
response_test.go
response_test.go
+12
-3
No files found.
command_test.go
View file @
5681ad62
...
...
@@ -15,7 +15,7 @@ func TestOptionValidation(t *testing.T) {
req
.
options
[
"foo"
]
=
5
res
:=
cmd
.
Call
(
req
)
if
res
.
Error
==
nil
{
t
.
Error
(
"Should have failed (unrecognized
command
)"
)
t
.
Error
(
"Should have failed (unrecognized
option
)"
)
}
req
=
NewRequest
()
...
...
@@ -37,7 +37,7 @@ func TestOptionValidation(t *testing.T) {
req
.
options
[
"beep"
]
=
5
res
=
cmd
.
Call
(
req
)
if
res
.
Error
!=
nil
{
t
.
Error
(
"Should have passed"
)
t
.
Error
(
res
.
Error
,
"Should have passed"
)
}
req
=
NewRequest
()
...
...
response_test.go
View file @
5681ad62
...
...
@@ -18,15 +18,24 @@ func TestMarshalling(t *testing.T) {
Value
:
TestOutput
{
"beep"
,
"boop"
,
1337
},
}
_
,
err
:=
res
.
Marshal
()
// get command global options so we can set the encoding option
cmd
:=
Command
{}
options
,
err
:=
cmd
.
GetOptions
(
nil
)
if
err
!=
nil
{
t
.
Error
(
err
)
}
_
,
err
=
res
.
Marshal
()
if
err
==
nil
{
t
.
Error
(
"Should have failed (no encoding type specified in request)"
)
}
req
.
SetOption
(
globalOptions
[
0
],
Json
)
req
.
SetOption
(
"enc"
,
Json
)
req
.
convertOptions
(
options
)
bytes
,
err
:=
res
.
Marshal
()
if
err
!=
nil
{
t
.
Error
(
"Should have passed"
)
t
.
Error
(
err
,
"Should have passed"
)
}
output
:=
string
(
bytes
)
if
output
!=
"{
\"
Foo
\"
:
\"
beep
\"
,
\"
Bar
\"
:
\"
boop
\"
,
\"
Baz
\"
:1337}"
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment