1
0
Fork 0

Two new unit tests

master
Philip O'Toole 1 year ago committed by GitHub
parent 5c782923f7
commit 9d413d071d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -62,6 +62,32 @@ func Test_HashCache(t *testing.T) {
} }
} }
func Test_AuthLoadEmpty(t *testing.T) {
const jsonStream = `[]`
store := NewCredentialsStore()
if err := store.Load(strings.NewReader(jsonStream)); err != nil {
t.Fatalf("failed to load empty JSON: %s", err.Error())
}
}
func Test_AuthLoadMalformed(t *testing.T) {
const jsonStream = `
[
{
"username": "username1",
"password": "password1",
"perms": ["foo", "bar"
}
]
`
store := NewCredentialsStore()
if err := store.Load(strings.NewReader(jsonStream)); err == nil {
t.Fatalf("expected error for malformed JSON input")
}
}
func Test_AuthLoadSingle(t *testing.T) { func Test_AuthLoadSingle(t *testing.T) {
const jsonStream = ` const jsonStream = `
[ [

Loading…
Cancel
Save