1
0
mirror of https://github.com/Tarrasch/zsh-autoenv.git synced 2025-12-15 02:35:12 +02:00

s/ENV_AUTHORIZATION_FILE/AUTOENV_ENV_FILENAME/

Ref: https://github.com/Tarrasch/zsh-autoenv/issues/6
This commit is contained in:
Daniel Hahler
2014-11-21 20:15:08 +01:00
parent d9529636b0
commit f31bb529de
6 changed files with 18 additions and 19 deletions

View File

@@ -1,4 +1,4 @@
test -f "$TESTDIR/.zcompdump" && rm "$TESTDIR/.zcompdump"
source "$TESTDIR/../autoenv.plugin.zsh"
export ENV_AUTHORIZATION_FILE="$PWD/.env_auth"
export AUTOENV_ENV_FILENAME="$PWD/.env_auth"

View File

@@ -6,14 +6,14 @@ Lets set a simple .env action
Manually create auth file
$ echo "$PWD/.env:$(echo echo ENTERED | shasum)" > $ENV_AUTHORIZATION_FILE
$ echo "$PWD/.env:$(echo echo ENTERED | shasum)" > $AUTOENV_ENV_FILENAME
$ cd .
ENTERED
Now try to make it accept it
$ unset _dotenv_stack_entered
$ rm $ENV_AUTHORIZATION_FILE
$ rm $AUTOENV_ENV_FILENAME
$ _dotenv_read_answer() { echo 'y' }
$ cd .
Attempting to load unauthorized env file: /tmp/cramtests-??????/autoenv.t/.env (glob)
@@ -40,8 +40,8 @@ Now lets see that it actually checks the shasum value
ENTERED
$ unset _dotenv_stack_entered
$ rm $ENV_AUTHORIZATION_FILE
$ echo "$PWD/.env:$(echo mischief | shasum)" > $ENV_AUTHORIZATION_FILE
$ rm $AUTOENV_ENV_FILENAME
$ echo "$PWD/.env:$(echo mischief | shasum)" > $AUTOENV_ENV_FILENAME
$ cd .
Attempting to load unauthorized env file: /tmp/cramtests-??????/autoenv.t/.env (glob)
@@ -61,7 +61,7 @@ Now lets see that it actually checks the shasum value
Now, will it take no for an answer?
$ unset _dotenv_stack_entered
$ rm $ENV_AUTHORIZATION_FILE
$ rm $AUTOENV_ENV_FILENAME
$ _dotenv_read_answer() { echo 'n' }
$ cd .
Attempting to load unauthorized env file: /tmp/cramtests-??????/autoenv.t/.env (glob)

View File

@@ -12,8 +12,8 @@ Setup env actions / output.
Manually create auth files.
$ echo "$PWD/$DOTENV_FILE_ENTER:$(echo $(<$DOTENV_FILE_ENTER) | shasum)" > $ENV_AUTHORIZATION_FILE
$ echo "$PWD/$DOTENV_FILE_LEAVE:$(echo $(<$DOTENV_FILE_LEAVE) | shasum)" >> $ENV_AUTHORIZATION_FILE
$ echo "$PWD/$DOTENV_FILE_ENTER:$(echo $(<$DOTENV_FILE_ENTER) | shasum)" > $AUTOENV_ENV_FILENAME
$ echo "$PWD/$DOTENV_FILE_LEAVE:$(echo $(<$DOTENV_FILE_LEAVE) | shasum)" >> $AUTOENV_ENV_FILENAME
The actual tests.

View File

@@ -1,6 +1,6 @@
# Ensure we have our mocked out ENV_AUTHORIZATION_FILE
# Ensure we have our mocked out AUTOENV_ENV_FILENAME
[[ $ENV_AUTHORIZATION_FILE[0,4] == '/tmp' ]] || return 1
[[ $AUTOENV_ENV_FILENAME[0,4] == '/tmp' ]] || return 1
# Inject timeout for `read` while running tests.
_AUTOENV_TEST_READ_ARGS='-t 1'

View File

@@ -16,8 +16,8 @@ Setup test environment.
Manually create auth file
$ echo "$PWD/$DOTENV_FILE_ENTER:$(echo $(<$DOTENV_FILE_ENTER) | shasum)" > $ENV_AUTHORIZATION_FILE
$ echo "$PWD/$DOTENV_FILE_LEAVE:$(echo $(<$DOTENV_FILE_LEAVE) | shasum)" >> $ENV_AUTHORIZATION_FILE
$ echo "$PWD/$DOTENV_FILE_ENTER:$(echo $(<$DOTENV_FILE_ENTER) | shasum)" > $AUTOENV_ENV_FILENAME
$ echo "$PWD/$DOTENV_FILE_LEAVE:$(echo $(<$DOTENV_FILE_LEAVE) | shasum)" >> $AUTOENV_ENV_FILENAME
Set environment variable.