summaryrefslogtreecommitdiff
path: root/web/server_test.go
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2026-08-05 14:17:59 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2026-08-05 14:17:59 +0200
commit71c39ed9f8ce3563130cdfc5099e9d7df60845a9 (patch)
treee610b8360f6364e3ab7c5e817ac94bd51cc0dfd1 /web/server_test.go
parentbef31e1d35fe88f2698cf0e3191f26a79623f66f (diff)
refactor: Replace env config with atomic YAML
Diffstat (limited to 'web/server_test.go')
-rw-r--r--web/server_test.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/web/server_test.go b/web/server_test.go
index 8d3f653..0324558 100644
--- a/web/server_test.go
+++ b/web/server_test.go
@@ -5,12 +5,12 @@ import (
"net/http"
"net/http/httptest"
"net/url"
- "os"
"path/filepath"
"strings"
"testing"
"time"
+ "github.com/martinlehoux/biking_home/config"
"github.com/martinlehoux/biking_home/rides"
_ "github.com/mattn/go-sqlite3"
"github.com/stretchr/testify/assert"
@@ -40,9 +40,12 @@ func newWebTestServer(t *testing.T) (*Server, *sql.DB) {
)
`)
require.NoError(t, err)
- envPath := filepath.Join(t.TempDir(), ".env")
- require.NoError(t, os.WriteFile(envPath, []byte("STRAVA_CLIENT_ID=123\nSTRAVA_CLIENT_SECRET=secret\n"), 0o600))
- return NewServer(db, envPath, t.TempDir(), "http://localhost:8080"), db
+ configPath := filepath.Join(t.TempDir(), "config.yaml")
+ appConfig := config.Default()
+ appConfig.Strava.ClientID = "123"
+ appConfig.Strava.ClientSecret = "secret"
+ require.NoError(t, config.Save(configPath, appConfig))
+ return NewServer(db, configPath), db
}
func TestHandlerRendersRidesPage(t *testing.T) {