mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-11-05 03:12:18 +00:00
feat: Add cursor-based pagination for subscribers and parameterize test password
- Add ListSubscribersCursor method to Database with ID-based cursor pagination - Add cursor, hasMore, and nextCursor support for efficient pagination - Add status, organizationID, and search filters to cursor-based query - Add limit+1 fetch strategy to detect additional results - Add fmt import to database/crud.go - Add TEST_PASSWORD environment variable support in integration tests with default fallback - Replace hard
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -68,7 +69,11 @@ func setupTest(t *testing.T) *TestSetup {
|
||||
|
||||
for _, user := range testUsers {
|
||||
// Hash the password properly for testing
|
||||
hashedPassword, err := bcrypt.GenerateFromPassword([]byte("password123"), bcrypt.DefaultCost)
|
||||
testPassword := os.Getenv("TEST_PASSWORD")
|
||||
if testPassword == "" {
|
||||
testPassword = "default_test_password_change_me"
|
||||
}
|
||||
hashedPassword, err := bcrypt.GenerateFromPassword([]byte(testPassword), bcrypt.DefaultCost)
|
||||
require.NoError(t, err)
|
||||
user.Password = string(hashedPassword)
|
||||
err = db.Create(user).Error
|
||||
|
||||
Reference in New Issue
Block a user