From 2b24dd9dd31d37c8f20ff4a541c0df86996db6af Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Tue, 10 Feb 2026 10:22:19 -0500 Subject: [PATCH] fix: Fix failing integration tests and update documentation - Fix TestUpdateDevice: Use correct JSON field name and handle float64 type - Fix TestRejectDeviceRegistration: Expect message response instead of boolean - Update approve device docs: Add missing response fields - Update reject device docs: Correct message text and format - Update Bruno API: Fix example response for reject endpoint Both integration tests now pass while maintaining API consistency. --- bruno/devices/Reject Device Registration.bru | 13 ++++++------- cmd/server/tests/device_test.go | 4 ++-- .../api/devices/approve_device_registration.md | 7 +++++-- .../api/devices/reject_device_registration.md | 2 +- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/bruno/devices/Reject Device Registration.bru b/bruno/devices/Reject Device Registration.bru index 2772e06..ce983d7 100644 --- a/bruno/devices/Reject Device Registration.bru +++ b/bruno/devices/Reject Device Registration.bru @@ -33,11 +33,10 @@ docs { - 404: Registration not found - 400: Invalid registration status - **Example Response:** - ```json - { - "message": "Device registration rejected", - "registration_id": "uuid" - } - ``` + **Example Response:** + ```json + { + "message": "device registration rejected" + } + ``` } diff --git a/cmd/server/tests/device_test.go b/cmd/server/tests/device_test.go index 7c70155..1ef65d9 100644 --- a/cmd/server/tests/device_test.go +++ b/cmd/server/tests/device_test.go @@ -173,7 +173,7 @@ func TestUpdateDevice(t *testing.T) { updatedDevice := response["device"].(map[string]interface{}) assert.Equal(t, "Updated Device Name", updatedDevice["device_name"], "Should have updated name") assert.Equal(t, false, updatedDevice["sync_enabled"], "Should be disabled") - assert.Equal(t, int32(10), updatedDevice["sync_frequency"], "Should have updated frequency") + assert.Equal(t, float64(10), updatedDevice["sync_frequency_minutes"], "Should have updated frequency") } func TestDeleteDevice(t *testing.T) { @@ -325,5 +325,5 @@ func TestRejectDeviceRegistration(t *testing.T) { var rejectResponse map[string]interface{} json.Unmarshal(rec.Body.Bytes(), &rejectResponse) - assert.True(t, rejectResponse["rejected"].(bool), "Should confirm rejection") + assert.Equal(t, "device registration rejected", rejectResponse["message"], "Should confirm rejection message") } diff --git a/docs/developer/api/devices/approve_device_registration.md b/docs/developer/api/devices/approve_device_registration.md index d16d090..e74b036 100644 --- a/docs/developer/api/devices/approve_device_registration.md +++ b/docs/developer/api/devices/approve_device_registration.md @@ -28,8 +28,11 @@ Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... ```json { - "message": "Device registration approved", - "device_id": "uuid" + "message": "device approved successfully", + "device_name": "string", + "device_type": "string", + "registration_id": "uuid", + "approved": true } ``` diff --git a/docs/developer/api/devices/reject_device_registration.md b/docs/developer/api/devices/reject_device_registration.md index 0eb3a83..4afaad7 100644 --- a/docs/developer/api/devices/reject_device_registration.md +++ b/docs/developer/api/devices/reject_device_registration.md @@ -28,7 +28,7 @@ Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... ```json { - "message": "Device registration rejected" + "message": "device registration rejected" } ```