mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-23 08:48:32 +02:00
feat(oidc): support token refreshing via offline_access scope
- refactored code - moved api/v1/auth to auth/ - security enhancement - env example update - default jwt ttl changed to 24 hours
This commit is contained in:
32
internal/jsonstore/jsonstore_test.go
Normal file
32
internal/jsonstore/jsonstore_test.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package jsonstore
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNewJSON(t *testing.T) {
|
||||
store := NewStore[string]("test")
|
||||
store.Store("a", "1")
|
||||
if v, _ := store.Load("a"); v != "1" {
|
||||
t.Fatal("expected 1, got", v)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSaveLoad(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
storesPath = filepath.Join(tmpDir, "data.json")
|
||||
store := NewStore[string]("test")
|
||||
store.Store("a", "1")
|
||||
if err := save(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
stores = nil
|
||||
if err := load(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
store = NewStore[string]("test")
|
||||
if v, _ := store.Load("a"); v != "1" {
|
||||
t.Fatal("expected 1, got", v)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user