Adds a unit test to make sure the status endpoint doesn't ever show anything

with "token" in the name.
This commit is contained in:
James Phillips 2016-12-12 22:09:35 -08:00
parent d51303b998
commit 34da7ccd64
No known key found for this signature in database
GPG Key ID: 77183E682AC5FC11
1 changed files with 10 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package agent
import (
"bytes"
"errors"
"fmt"
"io"
@ -117,6 +118,15 @@ func TestHTTPAgentSelf(t *testing.T) {
if val.Coord != nil {
t.Fatalf("should have been nil: %v", val.Coord)
}
// Make sure there's nothing called "token" that's leaked.
raw, err := srv.marshalJSON(req, obj)
if err != nil {
t.Fatalf("err: %v", err)
}
if bytes.Contains(bytes.ToLower(raw), []byte("token")) {
t.Fatalf("bad: %s", raw)
}
}
func TestHTTPAgentReload(t *testing.T) {