projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
18805: add a 'static' go build tag that disables the pam login code,
[arvados.git]
/
lib
/
controller
/
router
/
request_test.go
diff --git
a/lib/controller/router/request_test.go
b/lib/controller/router/request_test.go
index 89238f656345aa2d7ccf19b4889ead4955f17034..4544a6bb65f4692af7ffb15b190f6803c6f1bbc9 100644
(file)
--- a/
lib/controller/router/request_test.go
+++ b/
lib/controller/router/request_test.go
@@
-12,7
+12,7
@@
import (
"net/http/httptest"
"net/url"
"net/http/httptest"
"net/url"
- "git.
curoverse.com
/arvados.git/sdk/go/arvadostest"
+ "git.
arvados.org
/arvados.git/sdk/go/arvadostest"
check "gopkg.in/check.v1"
)
check "gopkg.in/check.v1"
)
@@
-49,10
+49,26
@@
func (tr *testReq) Request() *http.Request {
} else if tr.json {
if tr.jsonAttrsTop {
for k, v := range tr.attrs {
} else if tr.json {
if tr.jsonAttrsTop {
for k, v := range tr.attrs {
- param[k] = v
+ if tr.jsonStringParam {
+ j, err := json.Marshal(v)
+ if err != nil {
+ panic(err)
+ }
+ param[k] = string(j)
+ } else {
+ param[k] = v
+ }
}
} else if tr.attrs != nil {
}
} else if tr.attrs != nil {
- param[tr.attrsKey] = tr.attrs
+ if tr.jsonStringParam {
+ j, err := json.Marshal(tr.attrs)
+ if err != nil {
+ panic(err)
+ }
+ param[tr.attrsKey] = string(j)
+ } else {
+ param[tr.attrsKey] = tr.attrs
+ }
}
tr.body = bytes.NewBuffer(nil)
err := json.NewEncoder(tr.body).Encode(param)
}
tr.body = bytes.NewBuffer(nil)
err := json.NewEncoder(tr.body).Encode(param)
@@
-118,6
+134,8
@@
func (s *RouterSuite) TestAttrsInBody(c *check.C) {
for _, tr := range []testReq{
{attrsKey: "model_name", json: true, attrs: attrs},
{attrsKey: "model_name", json: true, attrs: attrs, jsonAttrsTop: true},
for _, tr := range []testReq{
{attrsKey: "model_name", json: true, attrs: attrs},
{attrsKey: "model_name", json: true, attrs: attrs, jsonAttrsTop: true},
+ {attrsKey: "model_name", json: true, attrs: attrs, jsonAttrsTop: true, jsonStringParam: true},
+ {attrsKey: "model_name", json: true, attrs: attrs, jsonAttrsTop: false, jsonStringParam: true},
} {
c.Logf("tr: %#v", tr)
req := tr.Request()
} {
c.Logf("tr: %#v", tr)
req := tr.Request()