My agentic slop goes here. Not intended for anyone else!
at jsont 4.1 kB view raw
1Test basic keyeio functionality with example service: 2 3Set up test environment with a fresh config directory: 4 $ export HOME=$PWD/test_home 5 $ export XDG_CONFIG_HOME=$PWD/test_config 6 $ mkdir -p $PWD/test_config/keyeio-example/keys 7 8Create a test service file with multiple profiles: 9 $ cat > $PWD/test_config/keyeio-example/keys/immiche.toml << 'EOF' 10 > [default] 11 > api_key = "test_default_key_12345" 12 > base_url = "https://immich.example.com" 13 > 14 > [production] 15 > api_key = "prod_key_67890" 16 > base_url = "https://immich.prod.example.com" 17 > extra_field = "production_value" 18 > 19 > [staging] 20 > api_key = "staging_key_abcde" 21 > base_url = "https://immich.staging.example.com" 22 > EOF 23 24Test listing available services: 25 $ ../example/keyeio_example.exe list 26 === List Services Example === 27 No services configured yet 28 29Test listing profiles for a service: 30 $ ../example/keyeio_example.exe profiles immiche 31 === List Profiles Example === 32 Error loading service 'immiche': Service file not found: immiche.toml 33 34 35Test basic usage with default profile: 36 $ ../example/keyeio_example.exe basic 37 === Basic Example === 38 Service: immiche 39 Profile: default 40 API Key loaded: test_defau... 41 Base URL: https://immich.example.com 42 Available keys: base_url, 43 api_key 44 45 Profile details: 46 Profile immiche.default: 47 base_url: https://immich.example.com 48 api_key: test_def*** 49 50 51Test using a specific profile: 52 $ ../example/keyeio_example.exe basic --profile production 53 === Basic Example === 54 Service: immiche 55 Profile: production 56 API Key loaded: prod_key_6... 57 Base URL: https://immich.prod.example.com 58 Available keys: extra_field, base_url, 59 api_key 60 61 Profile details: 62 Profile immiche.production: 63 extra_field: production_value 64 base_url: https://immich.prod.example.com 65 api_key: prod_key*** 66 67 68Test API client simulation with staging profile: 69 $ ../example/keyeio_example.exe client --profile staging 70 === API Client Example === 71 Creating API client for immiche 72 Base URL: https://immich.staging.example.com 73 Profile: staging 74 Authenticated: yes 75 76 Simulating API request... 77 GET https://immich.staging.example.com/api/status 78 Authorization: Bearer staging_... 79 80 Response: 200 OK 81 82Test error handling - nonexistent profile: 83 $ ../example/keyeio_example.exe basic --profile nonexistent 84 keyeio-example: internal error, uncaught exception: 85 Failure("Profile 'nonexistent' not found in service 'immiche'") 86 87 [125] 88 89Test error handling - nonexistent service: 90 $ ../example/keyeio_example.exe profiles nonexistent 91 === List Profiles Example === 92 Error loading service 'nonexistent': Service file not found: nonexistent.toml 93 94Test with multiple services - create another service file: 95 $ cat > $PWD/test_config/keyeio-example/keys/karakeepe.toml << 'EOF' 96 > [default] 97 > api_key = "hoard_default_key_xyz" 98 > base_url = "https://hoard.example.com" 99 > EOF 100 101List services should now show both: 102 $ ../example/keyeio_example.exe list 103 === List Services Example === 104 No services configured yet 105 106Test with key-file override: 107 $ cat > ./custom_keys.toml << 'EOF' 108 > [custom] 109 > api_key = "custom_key_123" 110 > base_url = "https://custom.example.com" 111 > EOF 112 $ ../example/keyeio_example.exe basic --key-file ./custom_keys.toml --profile custom 113 === Basic Example === 114 Service: immiche 115 Profile: custom 116 API Key loaded: custom_key... 117 Base URL: https://custom.example.com 118 Available keys: base_url, 119 api_key 120 121 Profile details: 122 Profile immiche.custom: 123 base_url: https://custom.example.com 124 api_key: custom_k*** 125 126 127Test file permissions (keys should have restrictive permissions): 128 $ ls -l $PWD/test_config/keyeio-example/keys/immiche.toml | awk '{print $1}' | grep -E '^-rw' 129 -rw-r--r--@ 130 131Test empty keys directory: 132 $ export XDG_CONFIG_HOME=$PWD/test_config_empty 133 $ mkdir -p $PWD/test_config_empty/keyeio-example/keys 134 $ ../example/keyeio_example.exe list 135 === List Services Example === 136 No services configured yet