|
1 | 1 | # The tests in this BATS module must be run as a (passwordless) sudo-enabled user. |
2 | 2 | # It is also required that the python irodsclient be installed under irods' ~/.local environment. |
3 | 3 |
|
| 4 | +. $BATS_TEST_DIRNAME/scripts/funcs |
4 | 5 |
|
5 | 6 | setup() { |
6 | | - local -A chars=( |
7 | | - [semicolon]=";" |
8 | | - [atsymbol]="@" |
9 | | - [equals]="=" |
10 | | - [ampersand]="&" |
11 | | - ) |
12 | | - [ $BATS_TEST_NUMBER = 1 ] && echo "---" >/tmp/PRC_test_issue_362 |
13 | | - local name=${BATS_TEST_DESCRIPTION##*_} |
14 | | - CHR="${chars[$name]}" |
| 7 | + |
| 8 | + iinit_as_rods |
| 9 | + |
| 10 | + setup_pam_login_for_user "test123" alice |
| 11 | + |
| 12 | + cat >~/test_get_home_coll.py <<-EOF |
| 13 | + import irods.test.helpers as h |
| 14 | + ses = h.make_session() |
| 15 | + home_coll = h.home_collection(ses) |
| 16 | + exit(0 if ses.collections.get(home_coll).path == home_coll |
| 17 | + and ses.pool.account._original_authentication_scheme.lower() in ('pam','pam_password') |
| 18 | + else 1) |
| 19 | + EOF |
15 | 20 | } |
16 | 21 |
|
17 | | -TEST_THE_TEST="" |
| 22 | +teardown() { |
| 23 | + iinit_as_rods |
| 24 | + finalize_pam_login_for_user alice |
| 25 | +} |
18 | 26 |
|
19 | 27 | prc_test() |
20 | 28 | { |
21 | | - local USER="alissa" |
22 | | - local PASSWORD=$(tr "." "$CHR" <<<"my.pass") |
23 | | - echo "$USER:$PASSWORD" | sudo chpasswd |
24 | | - if [ "$TEST_THE_TEST" = 1 ]; then |
25 | | - echo -n `date`: "" >&2 |
26 | | - { su - "$USER" -c "id" <<<"$PASSWORD" 2>/dev/null | grep $USER ; } >&2 |
27 | | - else |
28 | | - sudo su - irods -c "env PYTHON_IRODSCLIENT_TEST_PAM_PW_OVERRIDE='$PASSWORD' python -m unittest \ |
29 | | - irods.test.login_auth_test.TestLogins.test_escaped_pam_password_chars__362" |
30 | | - fi |
31 | | -} 2>> /tmp/PRC_test_issue_362 |
32 | | - |
33 | | -@test "test_with_atsymbol" { prc_test; } |
34 | | -@test "test_with_semicolon" { prc_test; } |
35 | | -@test "test_with_equals" { prc_test; } |
36 | | -@test "test_with_ampersand" { prc_test; } |
| 29 | + local CHR="$1" |
| 30 | + ## Arrange for secrets file to be generated internally by the Python client |
| 31 | + cat >~/.python_irodsclient <<-EOF |
| 32 | + legacy_auth.pam.store_password_to_environment True |
| 33 | + legacy_auth.pam.password_for_auto_renew 'my${CHR}pass' |
| 34 | + legacy_auth.pam.time_to_live_in_hours 1 |
| 35 | + EOF |
| 36 | + local USER="alice" |
| 37 | + local PASSWORD="my${CHR}pass" |
| 38 | + sudo chpasswd <<<"$USER:$PASSWORD" |
| 39 | + env PYTHON_IRODSCLIENT_CONFIGURATION_PATH='' python ~/test_get_home_coll.py |
| 40 | +} |
| 41 | + |
| 42 | +@test "test_with_atsymbol" { prc_test "@"; } |
| 43 | +@test "test_with_semicolon" { prc_test ";"; } |
| 44 | +@test "test_with_equals" { prc_test "="; } |
| 45 | +@test "test_with_ampersand" { prc_test "&"; } |
0 commit comments