This directory contains unit tests for the SOLAPI Python SDK. The tests cover all the functionality demonstrated in the examples folder.
- Python 3.9 or higher
- pytest
-
Install the required dependencies:
pip install pytest
-
Set up environment variables for API credentials and test phone numbers:
export SOLAPI_API_KEY="your_api_key" export SOLAPI_API_SECRET="your_api_secret" export SOLAPI_SENDER="your_registered_sender_number" export SOLAPI_RECIPIENT="recipient_phone_number" export SOLAPI_KAKAO_PF_ID="your_kakao_business_channel_id" export SOLAPI_KAKAO_TEMPLATE_ID="your_kakao_template_id"
Alternatively, you can modify the
conftest.pyfile to hardcode these values for testing purposes.
To run all tests:
pytestTo run a specific test file:
pytest tests/test_balance.pyTo run a specific test:
pytest tests/test_simple_send.py::TestSimpleSend::test_send_smsTo run tests with verbose output:
pytest -vtest_balance.py: Tests for checking account balancetest_group.py: Tests for message group operationstest_messages.py: Tests for retrieving message informationtest_simple_send.py: Tests for sending various types of messages (SMS, MMS, Kakao Alimtalk, etc.)test_storage.py: Tests for file upload operations
- The tests are designed to work with valid API credentials. If you provide invalid credentials, the tests will fail.
- Some tests (like Kakao Alimtalk) require specific setup in your SOLAPI account.
- The MMS and storage tests require the example image file to exist at
examples/images/example.jpg. - The tests are designed to be independent of each other, but they may create resources (like message groups) in your SOLAPI account.