Permalink
Browse files

Improve test for client.AddCapability()

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
  • Loading branch information...
1 parent 7d4c0df commit fe8ddc2c933db716ab9890f8c35b5315451786f6 @zyga zyga committed Dec 3, 2015
Showing with 14 additions and 0 deletions.
  1. +14 −0 client/client_test.go
View
@@ -20,6 +20,7 @@
package client_test
import (
+ "encoding/json"
"errors"
"io/ioutil"
"net/http"
@@ -170,4 +171,17 @@ func (cs *clientSuite) TestClientAddCapability(c *check.C) {
}
err := cs.cli.AddCapability(cap)
c.Check(err, check.IsNil)
+ b, err := ioutil.ReadAll(cs.req.Body)
+ c.Check(err, check.IsNil)
+ var body map[string]interface{}
+ err = json.Unmarshal(b, &body)
+ c.Check(err, check.IsNil)
+ c.Check(body, check.DeepEquals, map[string]interface{}{
+ "name": "n",
+ "label": "l",
+ "type": "t",
+ "attrs": map[string]interface{}{
+ "k": "v",
+ },
+ })
}

0 comments on commit fe8ddc2

Please sign in to comment.