Skip to content

Commit

Permalink
feat: integrate Gothic session management in basic authentication tests
Browse files Browse the repository at this point in the history
- Added support for session management using the Gothic library in basic_test.go.
- Initialized a filesystem store for sessions to enhance authentication handling during tests.
  • Loading branch information
tphakala committed Jan 9, 2025
1 parent 310336e commit 034475e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/security/basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import (
"testing"
"time"

"os"

"github.com/gorilla/sessions"
"github.com/labstack/echo/v4"
"github.com/markbates/goth/gothic"
"github.com/tphakala/birdnet-go/internal/conf"
)

Expand Down Expand Up @@ -166,6 +170,9 @@ func TestHandleBasicAuthTokenSuccess(t *testing.T) {
rec := httptest.NewRecorder()
c := e.NewContext(req, rec)

// Initialize Gothic session
gothic.Store = sessions.NewFilesystemStore(os.TempDir(), []byte("secret-key"))

s := &OAuth2Server{
Settings: &conf.Settings{
Security: conf.Security{
Expand Down

0 comments on commit 034475e

Please sign in to comment.