This commit is contained in:
parent
aa3e8cddf9
commit
6e3242bbd8
6 changed files with 91 additions and 41 deletions
|
|
@ -448,12 +448,17 @@ func newTestHandler(t *testing.T) (*Handler, func()) {
|
|||
}
|
||||
|
||||
logger := slog.New(slog.NewTextHandler(io.Discard, nil))
|
||||
handler := NewHandler(store, logger, "") // no auth token — endpoints will reject
|
||||
handler := NewHandler(store, logger, "", "") // no auth — endpoints will reject
|
||||
|
||||
return handler, func() { _ = store.Close() }
|
||||
}
|
||||
|
||||
func newTestHandlerWithToken(t *testing.T, token string) (*Handler, func()) {
|
||||
func newTestHandlerWithToken(t *testing.T, readToken string) (*Handler, func()) {
|
||||
t.Helper()
|
||||
return newTestHandlerWithKeys(t, readToken, readToken)
|
||||
}
|
||||
|
||||
func newTestHandlerWithKeys(t *testing.T, readToken, hmacKey string) (*Handler, func()) {
|
||||
t.Helper()
|
||||
dbPath := filepath.Join(t.TempDir(), "test.db")
|
||||
store, err := NewStore(dbPath)
|
||||
|
|
@ -462,7 +467,7 @@ func newTestHandlerWithToken(t *testing.T, token string) (*Handler, func()) {
|
|||
}
|
||||
|
||||
logger := slog.New(slog.NewTextHandler(io.Discard, nil))
|
||||
handler := NewHandler(store, logger, token)
|
||||
handler := NewHandler(store, logger, readToken, hmacKey)
|
||||
|
||||
return handler, func() { _ = store.Close() }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue