Skip to content

Refactor and modernize test suite for compatibility with recent library changes#86

Open
gretelliz wants to merge 1 commit intomainfrom
new_tests
Open

Refactor and modernize test suite for compatibility with recent library changes#86
gretelliz wants to merge 1 commit intomainfrom
new_tests

Conversation

@gretelliz
Copy link

Update and restructure pytest test suite to align with the latest sdx-lib changes introduced in PR #81

The previous test suite had become largely obsolete after the significant refactoring and API changes merged in #81.

This PR completely restructures and updates the tests to:

  • Use modern pytest + pytest-mock patterns consistently
  • Cover the current implementation of all main modules
  • Mock external dependencies properly (requests, subprocess, socket)
  • Handle new response formats, error paths, and parsing logic
  • Achieve meaningful coverage on previously untested or broken areas

Key additions and fixes:

  • Full coverage of VLAN parsing, range expansion/collapse, available ports calculation (with and without used VLANs)
  • Tests for input validation (URLs, names, emails, notifications)
  • Proper mocking and assertions for HTTP request/response handling and exceptions
  • Network utilities (ping, port checking) with correct exception handling and output verification
  • Fixed several broken tests caused by outdated mocks, missing imports, incorrect exception expectations, and mismatched output strings.

@gretelliz gretelliz requested a review from lmarinve February 4, 2026 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant