worker/server: extend the route tests a bit

Test the update and upload routes too, for completeness.
This commit is contained in:
Tom Gundersen 2020-11-10 18:47:14 +00:00 committed by Lars Karlitski
parent 5dac422b9c
commit 4a484c8192
2 changed files with 66 additions and 0 deletions

View file

@ -119,6 +119,10 @@ func TestRoute(t *testing.T, api API, external bool, method, path, body string,
require.Lenf(t, replyJSON, 0, "%s: expected no response body, but got:\n%s", path, replyJSON)
}
if expectedJSON == "?" {
return
}
var reply, expected interface{}
err = json.Unmarshal(replyJSON, &reply)
require.NoErrorf(t, err, "%s: json.Unmarshal failed for\n%s", path, string(replyJSON))