-
-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Server API: Get status #56
base: main
Are you sure you want to change the base?
Conversation
izzzzzi
commented
Feb 19, 2025
- Implement get_status() method in sync and async ServerApi
- Create Server model to represent server status
- Update demo.py with server status and database backup examples
- Add Server import to init.py
- Fix minor typos in demo.py comments
* Implement get_status() method in sync and async ServerApi * Create Server model to represent server status * Update demo.py with server status and database backup examples * Add Server import to __init__.py * Fix minor typos in demo.py comments
* Add comprehensive tests for get_status() in sync and async APIs * Implement tests for get_db() method with successful and error scenarios * Use requests_mock and httpx_mock for mocking API responses * Improve test coverage for server-related API methods
@izzzzzi, hello! Thank you for contributing to the project! Please, fix You can also use them locally before pushing the next commits: pip install mypy
pip install pylint mypy py3xui
pylint py3xui Looking forward to hearing from you. Thank you |
* Improve server status API methods in sync and async APIs * Add headers and data handling for server status requests * Update Server model with more robust field mappings * Modify demo.py to use simplified email variable * Add QR code directory creation logic * Update .gitignore to exclude QR code and database files
* Enhance test_api.py and test_async_api.py with more comprehensive server status response * Update server status test mocks to include additional fields like CPU cores, network stats, and Xray information * Modify exception handling in test_get_db_failed to use requests.exceptions.HTTPError
@izzzzzi, hey! I would suggest to comment the get_db test function back because it does exactly the same thing as before and crashes the tests. :D |
* Load server status response from external JSON file in both sync and async tests * Update test_api.py and test_async_api.py to use shared response file * Adjust URL endpoints and assertion values to match new response data * Simplify test mocking and improve test readability
* Replace hardcoded response dictionaries with JSON file loading in test_api.py and test_async_api.py * Use ApiFields constants for consistent response key references * Remove commented region markers and unnecessary imports * Standardize response loading for client traffic and other test scenarios