Added test capability and tests for authentication middleware

This commit is contained in:
2025-02-12 21:23:13 +11:00
parent ca92d573ba
commit 2d52084fa7
12 changed files with 334 additions and 9 deletions

20
tests/config.go Normal file
View File

@@ -0,0 +1,20 @@
package tests
import (
"os"
"projectreshoot/config"
"github.com/pkg/errors"
)
func TestConfig() (*config.Config, error) {
os.Setenv("TRUSTED_HOST", "127.0.0.1")
os.Setenv("TURSO_DB_NAME", ".")
os.Setenv("TURSO_AUTH_TOKEN", ".")
os.Setenv("SECRET_KEY", ".")
cfg, err := config.GetConfig(map[string]string{})
if err != nil {
return nil, errors.Wrap(err, "config.GetConfig")
}
return cfg, nil
}