Files
ss-tools/reproduce_mapping_issue.py
2026-02-18 17:29:46 +03:00

37 lines
1.2 KiB
Python

import requests
import json
import sys
# Try to find the port from app.py or common defaults
BASE_URL = "http://127.0.0.1:8000/api"
def test_save_mapping():
payload = {
"source_env_id": "ss1",
"target_env_id": "ss2",
"source_db_uuid": "test-uuid-1",
"target_db_uuid": "test-uuid-2",
"source_db_name": "Test Source DB",
"target_db_name": "Test Target DB"
}
print(f"Sending request to {BASE_URL}/mappings with payload: {json.dumps(payload, indent=2)}")
try:
# Note: We might need authentication headers if has_permission is active
# In a real tool use, we'd need to handle that, but for local testing
# let's see if the server is even running and if we get a 401/403 or something else.
response = requests.post(f"{BASE_URL}/mappings", json=payload)
print(f"Status Code: {response.status_code}")
try:
print(f"Response Body: {json.dumps(response.json(), indent=2)}")
except:
print(f"Raw Response: {response.text}")
except Exception as e:
print(f"Error: {e}")
if __name__ == "__main__":
if len(sys.argv) > 1:
BASE_URL = sys.argv[1]
test_save_mapping()