Skip to content

test: add comprehensive coverage for Termii SDK#2

Closed
samdoghor wants to merge 1 commit into
mainfrom
fix-client-args
Closed

test: add comprehensive coverage for Termii SDK#2
samdoghor wants to merge 1 commit into
mainfrom
fix-client-args

Conversation

@samdoghor
Copy link
Copy Markdown
Owner

This pull request introduces several improvements to the codebase, focusing on enhanced error handling, improved parameter validation, and the addition of comprehensive unit tests. It also includes minor dependency and version updates. The changes improve the reliability, maintainability, and test coverage of the project.

Error Handling Improvements:

  • Replaced generic ValueError exceptions with more descriptive ClientConfigError exceptions in TermiiClient, providing clearer guidance and actionable error messages when required configuration values are missing. [1] [2]

Parameter Validation and Logic Enhancements:

  • Improved channel and type parameter normalization and validation in send_message and send_bulk_message methods to ensure correct usage and clearer error messages, preventing misuse of WhatsApp and voice channels. [1] [2]
  • Updated the phone number validation logic to immediately reject non-string inputs, making PhoneNumber.is_valid_phone_number more robust.

Testing and Test Infrastructure:

  • Added extensive unit tests for TermiiClient configuration, HTTP request handling, and phone number value object, significantly increasing test coverage and reliability. [1] [2] [3]
  • Introduced an optional test dependency group in pyproject.toml for easier test setup with pytest.

Other Updates:

  • Updated the package version to 0.1.2 in termii_py/__init__.py.
  • Improved file upload handling in RequestHandler.post_file by using a context manager to ensure files are properly closed after upload.

@samdoghor samdoghor closed this Apr 3, 2026
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