diff --git a/mock-api/api_test.sh b/mock-api/api_test.sh deleted file mode 100755 index c6e464831..000000000 --- a/mock-api/api_test.sh +++ /dev/null @@ -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" \ diff --git a/mock-api/api_test.http b/test/test_api/api_test.http similarity index 98% rename from mock-api/api_test.http rename to test/test_api/api_test.http index de23c07f9..e78f68b58 100755 --- a/mock-api/api_test.http +++ b/test/test_api/api_test.http @@ -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) # 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_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 new file mode 100755 index 000000000..cc50fcdd2 --- /dev/null +++ b/test/test_api/api_test.sh @@ -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"