diff --git a/test_smoke_sync.sh b/test_smoke_sync.sh index 888acde..e09eb65 100755 --- a/test_smoke_sync.sh +++ b/test_smoke_sync.sh @@ -22,8 +22,16 @@ echo ":: Health" curl -sf "http://localhost:$SERVER_PORT/api/v1/health" | grep -q '"ok"' && echo " OK" echo ":: Register device" +# Register user first +curl -sf -X POST "http://localhost:$SERVER_PORT/api/v1/auth/register" \ + -H "Content-Type: application/json" \ + -d '{"username":"smokeuser","email":"smoke@test.local","password":"mypass123"}' > /dev/null +# Confirm email +TOKEN=$(sqlite3 "$SDIR/server.db" "SELECT token FROM server_email_tokens WHERE purpose='confirm' LIMIT 1") +curl -sf "http://localhost:$SERVER_PORT/api/v1/auth/confirm?token=$TOKEN" > /dev/null +# Register device with user creds REG=$(curl -sf -X POST "http://localhost:$SERVER_PORT/api/v1/device/register" \ - -H "Content-Type: application/json" -d '{"name":"smoke","username":"admin","password":"pass"}') + -H "Content-Type: application/json" -d '{"name":"smoke","username":"smokeuser","password":"mypass123"}') DID=$(echo "$REG" | python3 -c "import sys,json;print(json.load(sys.stdin)['device_id'])") AKEY=$(echo "$REG" | python3 -c "import sys,json;print(json.load(sys.stdin)['api_key'])") echo " device=$DID"