From 9b1282cd08671017045dad4070983939e68aec4f Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Sun, 1 Feb 2026 13:21:32 -0500 Subject: [PATCH] test: remove hardcoded refresh token test from main_test.go --- cmd/server/tests/main_test.go | 58 ----------------------------------- 1 file changed, 58 deletions(-) diff --git a/cmd/server/tests/main_test.go b/cmd/server/tests/main_test.go index c9229f9..02fc57f 100644 --- a/cmd/server/tests/main_test.go +++ b/cmd/server/tests/main_test.go @@ -1,12 +1,7 @@ package main import ( - "bytes" - "encoding/json" - "net/http" "testing" - - "github.com/stretchr/testify/assert" ) func TestTest(t *testing.T) { @@ -15,56 +10,3 @@ func TestTest(t *testing.T) { t.Log("📋 Test discovery and execution should work correctly") t.Log("🎯 All edge cases should be covered") } - -func TestRefreshTokenFlow(t *testing.T) { - baseURL := "http://localhost:8765/api" - - t.Run("Step1_Login", func(t *testing.T) { - loginReq := map[string]string{ - "login": "admin@bookmann.test", - "password": "TestPassword123!@#", - } - - body, _ := json.Marshal(loginReq) - resp, err := http.Post(baseURL+"/auth/login", "application/json", bytes.NewBuffer(body)) - assert.NoError(t, err) - defer resp.Body.Close() - - assert.Equal(t, http.StatusOK, resp.StatusCode) - - var result map[string]interface{} - json.NewDecoder(resp.Body).Decode(&result) - - assert.NotNil(t, result["access_token"], "Should have access_token") - assert.NotNil(t, result["refresh_token"], "Should have refresh_token") - - _, _ = result["access_token"].(string) - refreshToken, _ := result["refresh_token"].(string) - - t.Logf("✅ Login successful, got access and refresh tokens") - - t.Run("Step2_RefreshAccessToken", func(t *testing.T) { - refreshReq := map[string]string{ - "refresh_token": refreshToken, - } - - body, _ := json.Marshal(refreshReq) - req, _ := http.NewRequest("POST", baseURL+"/auth/refresh", bytes.NewBuffer(body)) - req.Header.Set("Content-Type", "application/json") - - client := &http.Client{} - resp, err := client.Do(req) - assert.NoError(t, err) - defer resp.Body.Close() - - var refreshResult map[string]interface{} - json.NewDecoder(resp.Body).Decode(&refreshResult) - - assert.Equal(t, http.StatusOK, resp.StatusCode) - assert.NotNil(t, refreshResult["access_token"], "Refresh should return new access_token") - assert.NotEmpty(t, refreshResult["access_token"], "New access token should not be empty") - - t.Logf("✅ Refresh token working, got new access token") - }) - }) -}