From e2671bb8187186fbec8933189673072480cc2cd2 Mon Sep 17 00:00:00 2001 From: Siddharth Tiwari Date: Thu, 18 Jan 2024 13:05:12 +0530 Subject: [PATCH] chore: adding logs --- tests/e2e/register-email.bash | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/e2e/register-email.bash b/tests/e2e/register-email.bash index e6621bc..fb7070d 100755 --- a/tests/e2e/register-email.bash +++ b/tests/e2e/register-email.bash @@ -5,7 +5,6 @@ AUTH_ENDPOINT="http://localhost:4455/auth/phone/login" EMAIL_REG_ENDPOINT="http://localhost:4455/auth/email/code" DB_CONTAINER="galoy-cli-kratos-pg-1" - get_email_code() { DB_USER="dbuser" DB_NAME="default" @@ -15,24 +14,26 @@ get_email_code() { echo $email_code } - register_email() { local PHONE=$1 local CODE="000000" local EMAIL=$2 local login_response=$(curl -s -X POST "$AUTH_ENDPOINT" -H "Content-Type: application/json" -d '{"phone": "'"$PHONE"'", "code":"'"$CODE"'"}') + echo "Login response: $login_response" local auth_token=$(echo "$login_response" | jq -r '.authToken') - mail_reg_init_response=$(curl -s -X POST $GRAPHQL_ENDPOINT -H "Content-Type: application/json" -H "Authorization: Bearer $auth_token" -d ' + local mail_reg_init_response=$(curl -s -X POST "$GRAPHQL_ENDPOINT" -H "Content-Type: application/json" -H "Authorization: Bearer $auth_token" -d ' { - "query": "mutation UserEmailRegistrationInitiate { userEmailRegistrationInitiate(input: { email: \"'$EMAIL'\" }) { emailRegistrationId errors { code message path } me { createdAt id language phone totpEnabled username } } }" + "query": "mutation UserEmailRegistrationInitiate { userEmailRegistrationInitiate(input: { email: \"'"$EMAIL"'\" }) { emailRegistrationId errors { code message path } me { createdAt id language phone totpEnabled username } } }" }') - email_registration_id=$(echo $mail_reg_init_response | jq -r '.data.userEmailRegistrationInitiate.emailRegistrationId') + local email_registration_id=$(echo "$mail_reg_init_response" | jq -r '.data.userEmailRegistrationInitiate.emailRegistrationId') + echo "Email registration ID: $email_registration_id" local email_code=$(get_email_code "$EMAIL") local email_reg_validate_response=$(curl -s -X POST "$GRAPHQL_ENDPOINT" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $auth_token" \ - -d '{"query": "mutation UserEmailRegistrationValidate { userEmailRegistrationValidate( input: { code: \"'"$email_code"'\" emailRegistrationId: \"'"$email_registration_id"'\" }) { errors { code message path } } }"}') + -d '{"query": "mutation UserEmailRegistrationValidate { userEmailRegistrationValidate( input: { code: \"'"$email_code"'\", emailRegistrationId: \"'"$email_registration_id"'\" }) { errors { code message path } } }"}') + echo "Email registration validate response: $email_reg_validate_response" }