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
7
local -A chars=(
@@ -12,25 +13,43 @@ setup() {
12
13
[ $BATS_TEST_NUMBER = 1 ] && echo " ---" > /tmp/PRC_test_issue_362
13
14
local name=${BATS_TEST_DESCRIPTION##* _}
14
15
CHR=" ${chars[$name]} "
15
- }
16
16
17
- TEST_THE_TEST=" "
17
+ # # Arrange for secrets file to be generated internally by the Python client
18
+ cat > ~/.python_irodsclient << -EOF
19
+ legacy_auth.pam.store_password_to_environment True
20
+ legacy_auth.pam.password_for_auto_renew 'my${CHR} pass'
21
+ legacy_auth.pam.time_to_live_in_hours 1
22
+ EOF
23
+
24
+ iinit_as_rods
25
+
26
+ if [ ! -e /tmp/rodsuser_alissa_created ]; then
27
+ iadmin mkuser alissa rodsuser
28
+ fi
29
+ touch /tmp/rodsuser_alissa_created
30
+
31
+ _begin_pam_environment_and_password " " alissa
32
+ rm -f ~ /.irods/.irodsA
33
+
34
+ cat > ~/test_get_home_coll.py << -EOF
35
+ import irods.test.helpers as h
36
+ ses = h.make_session()
37
+ home_coll = h.home_collection(ses)
38
+ exit(0 if ses.collections.get(home_coll).path == home_coll
39
+ and ses.pool.account._original_authentication_scheme.lower().startswith('pam')
40
+ else 1)
41
+ EOF
42
+ }
18
43
19
44
prc_test ()
20
45
{
21
46
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
47
+ local PASSWORD=" my${CHR} pass"
48
+ sudo chpasswd <<< " $USER:$PASSWORD"
49
+ env PYTHON_IRODSCLIENT_CONFIGURATION_PATH=' ' python ~ /test_get_home_coll.py
50
+ }
32
51
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; }
52
+ @test " test_with_atsymbol" { prc_test; }
53
+ @test " test_with_semicolon" { prc_test; }
54
+ @test " test_with_equals" { prc_test; }
55
+ @test " test_with_ampersand" { prc_test; }
0 commit comments