11#! /usr/bin/env bats
22#
33# Test creation of .irodsA for iRODS pam_password authentication using the free function,
4- # irods.client_init.write_native_credentials_to_secrets_file
4+ # irods.client_init.write_pam_credentials_to_secrets_file
55
66. " $BATS_TEST_DIRNAME " /test_support_functions
77PYTHON=python3
@@ -10,18 +10,26 @@ PYTHON=python3
1010# Run as ubuntu user with sudo; python_irodsclient must be installed (in either ~/.local or a virtualenv)
1111#
1212
13- @test create_irods_secrets_file {
13+ ALICES_OLD_PAM_PASSWD=" test123"
14+ ALICES_NEW_PAM_PASSWD=" new_pass"
1415
15- rm -fr ~ /.irods
16- mkdir ~ /.irods
17- cat > ~ /.irods/irods_environment.json << -EOF
18- { "irods_host":"$( hostname) ",
19- "irods_port":1247,
20- "irods_user_name":"rods",
21- "irods_zone_name":"tempZone"
22- }
23- EOF
24- $PYTHON -c " import irods.client_init; irods.client_init.write_native_credentials_to_secrets_file('rods')"
16+ setup ()
17+ {
18+ setup_pam_login_for_alice " $ALICES_OLD_PAM_PASSWD "
19+ }
20+
21+ teardown ()
22+ {
23+ finalize_pam_login_for_alice
24+ test_specific_cleanup
25+ }
26+
27+ @test create_secrets_file {
28+
29+ # Old .irodsA is already created, so we delete it and alter the pam password.
30+ sudo chpasswd <<< " alice:$ALICES_NEW_PAM_PASSWD"
31+ rm -f ~ /.irods/.irodsA
32+ $PYTHON -c " import irods.client_init; irods.client_init.write_pam_credentials_to_secrets_file('$ALICES_NEW_PAM_PASSWD ')"
2533
2634 # Define the core Python to be run, basically a minimal code block ensuring that we can authenticate to iRODS
2735 # without an exception being raised.
@@ -34,5 +42,6 @@ print ('env_auth_scheme=%s' % ses.pool.account._original_authentication_scheme)
3442"
3543 OUTPUT=$( $PYTHON -c " $SCRIPT " )
3644 # Assert passing value
37- [ $OUTPUT = " env_auth_scheme=native" ]
45+ [ $OUTPUT = " env_auth_scheme=pam_password" ]
46+
3847}
0 commit comments