test: update conflicts and device test signatures

- Remove handler parameter from test function calls
- Update test signatures to match new setupTestServer return values
- Fix compilation errors after test helper refactoring
- Ensure test consistency across all test files
This commit is contained in:
2026-02-06 17:06:12 -05:00
parent 56efae971e
commit 2ff8506718
3 changed files with 37 additions and 32 deletions
+13 -8
View File
@@ -14,7 +14,7 @@ import (
// TestUpdateUserMaxDevices tests the admin endpoint for updating user device cap
func TestUpdateUserMaxDevices(t *testing.T) {
ts, db, _, _ := setupTestServer(t)
ts, db, _ := setupTestServer(t)
defer ts.Close()
// Create test user with admin role
@@ -87,7 +87,7 @@ func TestUpdateUserMaxDevices(t *testing.T) {
// TestUpdateUserMaxDevicesValidation tests validation of max_devices parameter
func TestUpdateUserMaxDevicesValidation(t *testing.T) {
ts, db, _, _ := setupTestServer(t)
ts, db, _ := setupTestServer(t)
defer ts.Close()
// Create admin user and get token
@@ -149,7 +149,7 @@ func TestUpdateUserMaxDevicesValidation(t *testing.T) {
// TestUpdateUserMaxDevicesAuth tests authentication requirements
func TestUpdateUserMaxDevicesAuth(t *testing.T) {
ts, db, _, _ := setupTestServer(t)
ts, db, _ := setupTestServer(t)
defer ts.Close()
// Create admin user
@@ -203,7 +203,7 @@ func TestUpdateUserMaxDevicesAuth(t *testing.T) {
// TestUpdateUserMaxDevicesNonExistentUser tests with non-existent user ID
func TestUpdateUserMaxDevicesNonExistentUser(t *testing.T) {
ts, db, _, _ := setupTestServer(t)
ts, db, _ := setupTestServer(t)
defer ts.Close()
// Create admin user
@@ -235,7 +235,7 @@ func TestUpdateUserMaxDevicesNonExistentUser(t *testing.T) {
// TestUpdateUserMaxDevicesMissingUserID tests with missing user ID in URL
func TestUpdateUserMaxDevicesMissingUserID(t *testing.T) {
ts, db, _, _ := setupTestServer(t)
ts, db, _ := setupTestServer(t)
defer ts.Close()
// Create admin user
@@ -264,7 +264,7 @@ func TestUpdateUserMaxDevicesMissingUserID(t *testing.T) {
// TestListUsersIncludesMaxDevices tests that List Users returns max_devices field
func TestListUsersIncludesMaxDevices(t *testing.T) {
ts, db, _, _ := setupTestServer(t)
ts, db, _ := setupTestServer(t)
defer ts.Close()
// Create admin user
@@ -363,8 +363,13 @@ func getAdminToken(t *testing.T, ts *httptest.Server, userID uuid.UUID) string {
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
token := result["access_token"].(string)
return token
// Safe type assertion with check
if accessToken, ok := result["access_token"].(string); ok {
return accessToken
}
// Handle error case - if login failed, return empty string
return ""
}
// Helper function to login user by credentials