fix test files
This commit is contained in:
@@ -6,12 +6,20 @@ import (
|
||||
"database/sql"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/DATA-DOG/go-sqlmock"
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
os.Setenv("GO_ENV", "development")
|
||||
code := m.Run()
|
||||
os.Unsetenv("GO_ENV")
|
||||
os.Exit(code)
|
||||
}
|
||||
|
||||
func setupMockDB(t *testing.T) (*sql.DB, sqlmock.Sqlmock, func()) {
|
||||
mockDB, mock, err := sqlmock.New()
|
||||
if err != nil {
|
||||
@@ -99,7 +107,7 @@ func TestSetupRoutes_AuthCheckEndpoint(t *testing.T) {
|
||||
if w.Code == http.StatusNotFound {
|
||||
t.Error("Auth check endpoint should be registered")
|
||||
}
|
||||
|
||||
|
||||
// Will likely return 401 (no JWT) or 500 (no DB) but that's OK - route exists
|
||||
if w.Code != http.StatusUnauthorized && w.Code != http.StatusInternalServerError && w.Code != http.StatusForbidden {
|
||||
t.Logf("Auth check returned status %d (expected 401, 403, or 500 without proper setup)", w.Code)
|
||||
|
||||
Reference in New Issue
Block a user