Skip to content

Commit

Permalink
chore: adding logs
Browse files Browse the repository at this point in the history
  • Loading branch information
siddhart1o1 committed Jan 18, 2024
1 parent 9f02830 commit e2671bb
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tests/e2e/register-email.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
}

0 comments on commit e2671bb

Please sign in to comment.