Skip to content

Commit

Permalink
πŸ§‘β€πŸ’» login command - print selected username to avoid ambiguity
Browse files Browse the repository at this point in the history
  • Loading branch information
πŸ’₯Hedi Ghediri committed Jul 31, 2024
1 parent 5499b6e commit 7534c2f
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions test/integration/test-login.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ cp -R $SCRIPT_DIR/../packages-src/login $CL_HOME/dropins
###
RESULT=$(echo | $CL_PATH login -p test-password) # The echo simulates an empty input from the user
echo -e "Actual:\n$RESULT"
printenv # debug
EXPECTED_USERNAME_PROMPT="Please enter your user name [$(whoami)]: "
TEST_DESCRIPTION="should prompt '$EXPECTED_USERNAME_PROMPT'"
if ! grep -qF "$EXPECTED_USERNAME_PROMPT" <(echo "$RESULT"); then
Expand All @@ -39,18 +38,28 @@ else
echo "OK - $TEST_DESCRIPTION"
fi

EXPECTED_PASSWORD="CL_PASSWORD: test-password"
TEST_DESCRIPTION="should have password test-password"
if ! grep -qF "$EXPECTED_PASSWORD" <(echo "$RESULT"); then

###
# login with -u
###
RESULT=$($CL_PATH login -u test-user -p test-password)
echo -e "Actual:\n$RESULT"
EXPECTED_USERNAME_PROMPT="Please enter your user name [test-user]: "
TEST_DESCRIPTION="should prompt '$EXPECTED_USERNAME_PROMPT'"
if ! grep -qF "$EXPECTED_USERNAME_PROMPT" <(echo "$RESULT"); then
echo "KO - $TEST_DESCRIPTION"
exit 1
else
echo "OK - $TEST_DESCRIPTION"
fi



###
# login with specified user
###
# TODO
RESULT=$($CL_PATH print-credentials)
echo -e "Actual:\n$RESULT"
EXPECTED_USERNAME="CL_USERNAME: test-user"
TEST_DESCRIPTION="should have username test-user"
if ! grep -qF "$EXPECTED_USERNAME" <(echo "$RESULT"); then
echo "KO - $TEST_DESCRIPTION"
exit 1
else
echo "OK - $TEST_DESCRIPTION"
fi

0 comments on commit 7534c2f

Please sign in to comment.