1 $ source $TESTDIR/setup.zsh || return 1
3 Lets set a simple .env action
5 $ echo 'echo ENTERED' > .env
7 Manually create auth file
9 $ test_autoenv_add_to_env $PWD/.env
13 Now try to make it accept it
15 $ _autoenv_stack_entered=()
16 $ rm $AUTOENV_ENV_FILENAME
17 $ _autoenv_ask_for_yes() { echo "yes" }
19 Attempting to load unauthorized env file!
20 -* /tmp/cramtests-*/autoenv.t/.env (glob)
22 **********************************************
26 **********************************************
28 Would you like to authorize it? (type 'yes') yes
32 The last "ENTERED" is because it executed the command.
34 Now lets see that it actually checks the shasum value.
36 $ _autoenv_stack_entered=()
40 $ _autoenv_stack_entered=()
41 $ rm $AUTOENV_ENV_FILENAME
42 $ test_autoenv_add_to_env $PWD/.env mischief
44 Attempting to load unauthorized env file!
45 -* /tmp/cramtests-*/autoenv.t/.env (glob)
47 **********************************************
51 **********************************************
53 Would you like to authorize it? (type 'yes') yes
57 Now, will it take no for an answer?
59 $ _autoenv_stack_entered=()
60 $ rm $AUTOENV_ENV_FILENAME
61 $ _autoenv_ask_for_yes() { echo "no"; return 1 }
63 Attempting to load unauthorized env file!
64 -* /tmp/cramtests-*/autoenv.t/.env (glob)
66 **********************************************
70 **********************************************
72 Would you like to authorize it? (type 'yes') no
75 Lets also try one more time to ensure it didn't add it.
77 $ _autoenv_ask_for_yes() { echo "yes"; return 0 }
79 Attempting to load unauthorized env file!
80 -* /tmp/cramtests-*/autoenv.t/.env (glob)
82 **********************************************
86 **********************************************
88 Would you like to authorize it? (type 'yes') yes
91 Reloading the script should keep the current state, e.g. when reloading your
94 $ $TEST_SOURCE_AUTOENV