move tests

This commit is contained in:
proddy
2024-10-21 10:32:41 +02:00
parent 4bd95b77c9
commit a049f063a1
3 changed files with 33 additions and 17 deletions

View File

@@ -1,16 +0,0 @@
#!/bin/sh
# API
curl -X GET http://ems-esp.local/api/system/info
echo "\n"
# HA
ha_url="http://192.168.1.42: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" \

View File

@@ -3,7 +3,8 @@
# Open this file in VSC, modify the token, go to the API call and click on 'Send Request' (or Ctrl+Alt+R) # 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 # The response will be shown in the right panel
@host = http://ems-esp.local # @host = http://ems-esp.local
@host = http://192.168.1.206
@host_dev = http://10.10.10.175 @host_dev = http://10.10.10.175
@host_standalone = http://localhost:3080 @host_standalone = http://localhost:3080
@host_standalone2 = http://localhost:3082 @host_standalone2 = http://localhost:3082

31
test/test_api/api_test.sh Executable file
View File

@@ -0,0 +1,31 @@
#!/bin/sh
#
# Command line test for the API
#
# EMS_ESP API
emsesp_url="http://192.168.1.206"
emsesp_token="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiYWRtaW4iOnRydWV9.2bHpWya2C7Q12WjNUBD6_7N3RCD7CMl-EGhyQVzFdDg"
curl -X GET ${emsesp_url}/api/system/info
echo "\n"
curl -X POST \
-H "Authorization: Bearer ${emsesp_token}" \
-H "Content-Type: application/json" \
-d '{"data":"8 1"}' \
${emsesp_url}/api/system/read
echo "\n"
# HA API
ha_url="http://192.168.1.42: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"