From 74062bab57bf59ef06c7308d7caeab7d05fd36f1 Mon Sep 17 00:00:00 2001 From: proddy Date: Sun, 26 Apr 2026 16:07:45 +0200 Subject: [PATCH] update tests --- test/test_api/api_test.http | 5 ++--- test/test_api/api_test.sh | 28 +++++++++++++++++++--------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/test/test_api/api_test.http b/test/test_api/api_test.http index 1a37372bc..e8a1af255 100755 --- a/test/test_api/api_test.http +++ b/test/test_api/api_test.http @@ -3,9 +3,8 @@ # Open this file in VSC, modify the token, go to the API call and click on 'Send Request' (or Ctrl+Alt+R) # The response will be shown in the right panel -# @host = http://ems-esp.local -@host = http://192.168.1.223 -@host_dev = http://192.168.1.65 +@host = http://ems-esp.local +@host_dev = http://ems-espT.local @host_standalone = http://localhost:3080 @host_standalone2 = http://localhost:3082 diff --git a/test/test_api/api_test.sh b/test/test_api/api_test.sh index 8deaa3013..0de8cde3b 100755 --- a/test/test_api/api_test.sh +++ b/test/test_api/api_test.sh @@ -4,7 +4,8 @@ # Command line test for the API # -emsesp_url="http://192.168.1.223" +# emsesp_url="http://ems-esp.local" +emsesp_url="http://ems-espT.local" # get the token from the Security page. This is the token for the admin user, unless changed it'll always be the same emsesp_token="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiYWRtaW4iOnRydWV9.2bHpWya2C7Q12WjNUBD6_7N3RCD7CMl-EGhyQVzFdDg" @@ -40,13 +41,22 @@ curl -X POST \ echo "\n" +# Get all versions +curl -X POST \ + -H "Authorization: Bearer ${emsesp_token}" \ + -H "Content-Type: application/json" \ + -d '{"action":"getVersions"}' \ + ${emsesp_url}/rest/action + +echo "\n" + # This example is how to call a service in Home Assistant via the API # Which can be added to an EMS-EPS schedule - -ha_url="http://192.168.1.86:8123" -ha_token="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIwMzMyZjU1MjhlZmM0NGIyOTgyMjIxNThiODU1NDkyNSIsImlhdCI6MTcyMTMwNDg2NSwiZXhwIjoyMDM2NjY0ODY1fQ.Q-Y7E_i7clH3ff4Ma-OMmhZfbN7aMi_CahKwmoar" - -curl -X POST \ - ${ha_url}/api/services/script/test_notify \ - -H "Authorization: Bearer ${ha_token}" \ - -H "Content-Type: application/json" +# +# ha_url="http://192.168.1.86:8123" +# ha_token="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIwMzMyZjU1MjhlZmM0NGIyOTgyMjIxNThiODU1NDkyNSIsImlhdCI6MTcyMTMwNDg2NSwiZXhwIjoyMDM2NjY0ODY1fQ.Q-Y7E_i7clH3ff4Ma-OMmhZfbN7aMi_CahKwmoar" +# +# curl -X POST \ +# ${ha_url}/api/services/script/test_notify \ +# -H "Authorization: Bearer ${ha_token}" \ +# -H "Content-Type: application/json"