refactor: introduce constants for improved maintainability in tests and server configurations

- Added constants for test endpoints, usernames, and XML headers in client_test.go and device_certificates_test.go to enhance readability and reduce hardcoded values.
- Updated various test cases to utilize these constants, ensuring consistency across tests.
- Refactored imaging settings and server configurations to use defined constants for default values, improving clarity and maintainability in server/device.go and server/imaging.go.
- Enhanced comments throughout the code to clarify functionality and adhere to best practices.
This commit is contained in:
0x524a
2025-12-02 21:39:54 -05:00
parent 31df3f8b79
commit c1daba5be6
25 changed files with 253 additions and 159 deletions
+9
View File
@@ -7,6 +7,8 @@ import (
)
// These handlers are better tested through the SOAP handler in integration tests.
//
//nolint:unused // Disabled test function kept for reference
func _DisabledTestHandleGetPresets(t *testing.T) {
config := createTestConfig()
server, _ := New(config)
@@ -75,6 +77,8 @@ func TestHandleGotoPreset(t *testing.T) {
}
// TestHandleGetStatus - DISABLED due to SOAP namespace requirements.
//
//nolint:unused // Disabled test function kept for reference
func _DisabledTestHandleGetStatus(t *testing.T) {
config := createTestConfig()
server, _ := New(config)
@@ -112,6 +116,7 @@ func _DisabledTestHandleGetStatus(t *testing.T) {
// TestHandleAbsoluteMove - DISABLED due to SOAP namespace requirements
//
//nolint:dupl // Disabled test functions have similar structure
//nolint:unused // Disabled test function kept for reference
func _DisabledTestHandleAbsoluteMove(t *testing.T) {
config := createTestConfig()
server, _ := New(config)
@@ -154,6 +159,7 @@ func _DisabledTestHandleAbsoluteMove(t *testing.T) {
// TestHandleRelativeMove - DISABLED due to SOAP namespace requirements
//
//nolint:dupl // Disabled test functions have similar structure
//nolint:unused // Disabled test function kept for reference
func _DisabledTestHandleRelativeMove(t *testing.T) {
config := createTestConfig()
server, _ := New(config)
@@ -196,6 +202,7 @@ func _DisabledTestHandleRelativeMove(t *testing.T) {
// TestHandleContinuousMove - DISABLED due to SOAP namespace requirements
//
//nolint:dupl // Disabled test functions have similar structure
//nolint:unused // Disabled test function kept for reference
func _DisabledTestHandleContinuousMove(t *testing.T) {
config := createTestConfig()
server, _ := New(config)
@@ -236,6 +243,8 @@ func _DisabledTestHandleContinuousMove(t *testing.T) {
}
// TestHandleStop - DISABLED due to SOAP namespace requirements.
//
//nolint:unused // Disabled test function kept for reference
func _DisabledTestHandleStop(t *testing.T) {
config := createTestConfig()
server, _ := New(config)