#!/bin/bash # test/manual/api/test_character_eve_id_fix.sh # ─── Manual Test for Character EVE ID Fix (Issue #539) ──────────────────────── # # This script tests the fix for GitHub issue #539 where character_eve_id # was being ignored when creating/updating signatures via the REST API. # # Usage: # 1. Create a .env file in this directory with: # API_TOKEN=your_map_public_api_key # API_BASE_URL=http://localhost:8000 # or your server URL # MAP_SLUG=your_map_slug # VALID_CHAR_ID=111111111 # A character that exists in your database # INVALID_CHAR_ID=999999999 # A character that does NOT exist # # 2. Run: ./test_character_eve_id_fix.sh # # Prerequisites: # - curl and jq must be installed # - A map must exist with a valid API token # - At least one system must be added to the map set -eu source "$(dirname "$0")/utils.sh" echo "═══════════════════════════════════════════════════════════════════" echo "Testing Character EVE ID Fix (GitHub Issue #539)" echo "═══════════════════════════════════════════════════════════════════" echo "" # Check required environment variables : "${API_BASE_URL:?Error: API_BASE_URL not set}" : "${MAP_SLUG:?Error: MAP_SLUG not set}" : "${VALID_CHAR_ID:?Error: VALID_CHAR_ID not set (provide a character eve_id that exists in DB)}" : "${INVALID_CHAR_ID:?Error: INVALID_CHAR_ID not set (provide a non-existent character eve_id)}" # Get a system to use for testing echo "📋 Fetching available systems from map..." SYSTEMS_RAW=$(make_request GET "$API_BASE_URL/api/maps/$MAP_SLUG/systems") SYSTEMS_STATUS=$(parse_status "$SYSTEMS_RAW") SYSTEMS_RESPONSE=$(parse_response "$SYSTEMS_RAW") if [ "$SYSTEMS_STATUS" != "200" ]; then echo "❌ Failed to fetch systems (HTTP $SYSTEMS_STATUS)" echo "$SYSTEMS_RESPONSE" exit 1 fi # Extract first system's solar_system_id SOLAR_SYSTEM_ID=$(echo "$SYSTEMS_RESPONSE" | jq -r '.data[0].solar_system_id // empty') if [ -z "$SOLAR_SYSTEM_ID" ]; then echo "❌ No systems found in map. Please add at least one system first." exit 1 fi echo "✅ Using solar_system_id: $SOLAR_SYSTEM_ID" echo "" # ═══════════════════════════════════════════════════════════════════════ # Test 1: Create signature with valid character_eve_id # ═══════════════════════════════════════════════════════════════════════ echo "─────────────────────────────────────────────────────────────────" echo "Test 1: Create signature with VALID character_eve_id" echo "─────────────────────────────────────────────────────────────────" PAYLOAD1=$(cat <