refactor: improve media service client methods and clean up test files

- Introduced helper methods `getMediaEndpoint` and `getMediaSoapClient` in the media client for better code reuse and clarity.
- Updated various media service methods to utilize the new helper methods, enhancing maintainability.
- Cleaned up test files by standardizing formatting and removing unnecessary blank lines for improved readability.
This commit is contained in:
0x524a
2025-12-02 01:22:06 -05:00
parent 202218e24e
commit 2ea36220f7
9 changed files with 177 additions and 176 deletions
+27 -27
View File
@@ -174,9 +174,9 @@ func TestVideoEncoderConfigurationStructure(t *testing.T) {
Quality: 80,
Resolution: VideoResolution{Width: 1920, Height: 1080},
RateControl: &VideoRateControl{
FrameRateLimit: 30,
FrameRateLimit: 30,
EncodingInterval: 1,
BitrateLimit: 2048,
BitrateLimit: 2048,
},
}
@@ -225,28 +225,28 @@ func TestGetProfilesResponseXML(t *testing.T) {
func TestIntRectangle(t *testing.T) {
tests := []struct {
name string
rect IntRectangle
name string
rect IntRectangle
expectValid bool
}{
{
name: "Valid rectangle",
rect: IntRectangle{X: 0, Y: 0, Width: 100, Height: 100},
name: "Valid rectangle",
rect: IntRectangle{X: 0, Y: 0, Width: 100, Height: 100},
expectValid: true,
},
{
name: "Zero width",
rect: IntRectangle{X: 0, Y: 0, Width: 0, Height: 100},
name: "Zero width",
rect: IntRectangle{X: 0, Y: 0, Width: 0, Height: 100},
expectValid: false,
},
{
name: "Zero height",
rect: IntRectangle{X: 0, Y: 0, Width: 100, Height: 0},
name: "Zero height",
rect: IntRectangle{X: 0, Y: 0, Width: 100, Height: 0},
expectValid: false,
},
{
name: "Negative dimensions",
rect: IntRectangle{X: -10, Y: -10, Width: 100, Height: 100},
name: "Negative dimensions",
rect: IntRectangle{X: -10, Y: -10, Width: 100, Height: 100},
expectValid: true, // Negative coordinates may be valid
},
}
@@ -263,33 +263,33 @@ func TestIntRectangle(t *testing.T) {
func TestVideoResolution(t *testing.T) {
tests := []struct {
name string
resolution VideoResolution
name string
resolution VideoResolution
expectValid bool
}{
{
name: "1080p",
resolution: VideoResolution{Width: 1920, Height: 1080},
name: "1080p",
resolution: VideoResolution{Width: 1920, Height: 1080},
expectValid: true,
},
{
name: "720p",
resolution: VideoResolution{Width: 1280, Height: 720},
name: "720p",
resolution: VideoResolution{Width: 1280, Height: 720},
expectValid: true,
},
{
name: "VGA",
resolution: VideoResolution{Width: 640, Height: 480},
name: "VGA",
resolution: VideoResolution{Width: 640, Height: 480},
expectValid: true,
},
{
name: "4K",
resolution: VideoResolution{Width: 3840, Height: 2160},
name: "4K",
resolution: VideoResolution{Width: 3840, Height: 2160},
expectValid: true,
},
{
name: "Zero width",
resolution: VideoResolution{Width: 0, Height: 1080},
name: "Zero width",
resolution: VideoResolution{Width: 0, Height: 1080},
expectValid: false,
},
}
@@ -306,9 +306,9 @@ func TestVideoResolution(t *testing.T) {
func TestMulticastConfiguration(t *testing.T) {
cfg := MulticastConfiguration{
Address: IPAddress{IPv4Address: "239.255.255.250"},
Port: 1900,
TTL: 128,
Address: IPAddress{IPv4Address: "239.255.255.250"},
Port: 1900,
TTL: 128,
AutoStart: true,
}