Test Modules ============ test_api_server.py ------------------ Integration test script for the Flask REST server. **Base URL:** ``http://127.0.0.1:5001`` Functions ~~~~~~~~~ .. py:function:: print_response(response) Pretty-print status code and JSON body (or raw text). .. py:function:: test_health_check() Send ``GET /health`` and print the response. .. py:function:: test_list_apis() Send ``GET /api/list`` and print the response. .. py:function:: test_authentication(username, password) Send ``POST /api/auth`` and return True if status is 200. .. py:function:: test_get_all_assets() Send ``GET /api/get-all?page_num=1&per_page=5``. .. py:function:: test_get_asset_by_id(asset_id) Send ``GET /api/get-asset-id?id={asset_id}``. .. py:function:: main() Orchestrate tests in order: health → list → auth → get-all → get-by-id (if auth succeeds). Usage: .. code-block:: bash python3 test_api_server.py test_create_api.py ------------------ End-to-end test for the ``create`` asset endpoint. Functions ~~~~~~~~~ .. py:function:: print_response(response) Pretty-print status code and JSON body. .. py:function:: authenticate(username, password) Send ``POST /api/auth`` and return True on 200. .. py:function:: create_asset(asset_data) Send ``POST /api/create`` with the provided asset JSON. .. py:function:: load_config() Load ``evercycle-api/config/create.json`` and return the parsed dict. .. py:function:: main() 1. Load create config. 2. Prompt for credentials (or read from argv). 3. Authenticate. 4. Randomize ``serial_number`` and ``asset_reference`` to avoid conflicts. 5. Optionally allow interactive customization of all body fields. 6. Send the create request. Usage: .. code-block:: bash python3 test_create_api.py