mirror of
https://github.com/rqlite/rqlite.git
synced 2026-01-25 04:16:26 +00:00
Two new unit tests
This commit is contained in:
@@ -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) {
|
||||
const jsonStream = `
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user