From b3662d4876dbbcb459eebd5ad6529bfe4a1c371b Mon Sep 17 00:00:00 2001 From: mirivlad Date: Mon, 1 Jun 2026 23:36:38 +0800 Subject: [PATCH] test: update smoke test for user auth flow --- test_smoke_sync.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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"