File tree Expand file tree Collapse file tree 2 files changed +90
-0
lines changed
Expand file tree Collapse file tree 2 files changed +90
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bats
2+
3+ . " $BATS_TEST_DIRNAME " /funcs
4+ PYTHON=python3
5+
6+ # Setup/prerequisites are same as for login_auth_test.
7+ # Run as ubuntu user with sudo; python_irodsclient must be installed (in either ~/.local or a virtualenv)
8+ #
9+
10+ PASSWD=test123
11+ NEW_PAM_PASSWD=" new_pass"
12+
13+ setup ()
14+ {
15+ setup_pam_login_for_alice $PASSWD
16+ }
17+
18+ teardown ()
19+ {
20+ finalize_pam_login_for_alice
21+ test_specific_cleanup
22+ }
23+
24+ @test create_secrets_file {
25+
26+ sudo chpasswd <<< " alice:$NEW_PAM_PASSWD"
27+ rm -f ~ /.irods/.irodsA
28+ $PYTHON -c " import irods.client_init; irods.client_init.write_pam_credentials_to_secrets_file('$NEW_PAM_PASSWD ')"
29+
30+
31+ # Define the core Python to be run, basically a minimal code block ensuring that we can authenticate to iRODS
32+ # without an exception being raised.
33+
34+ local SCRIPT="
35+ import irods.test.helpers as h
36+ ses = h.make_session()
37+ ses.collections.get(h.home_collection(ses))
38+ print ('env_auth_scheme=%s' % ses.pool.account._original_authentication_scheme)
39+ "
40+ OUTPUT=$( $PYTHON -c " $SCRIPT " )
41+ # Assert passing value
42+ [ $OUTPUT = env_auth_scheme= pam_password ]
43+
44+ }
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bats
2+
3+ . " $BATS_TEST_DIRNAME " /funcs
4+ PYTHON=python3
5+
6+ # Setup/prerequisites are same as for login_auth_test.
7+ # Run as ubuntu user with sudo; python_irodsclient must be installed (in either ~/.local or a virtualenv)
8+ #
9+
10+ setup ()
11+ {
12+ :
13+ }
14+
15+ teardown ()
16+ {
17+ :
18+ }
19+
20+ @test create_irods_secrets_file {
21+
22+ rm -fr ~ /.irods
23+ mkdir ~ /.irods
24+ cat > ~ /.irods/irods_environment.json << -EOF
25+ { "irods_host":"$( hostname) ",
26+ "irods_port":1247,
27+ "irods_user_name":"rods",
28+ "irods_zone_name":"tempZone"
29+ }
30+ EOF
31+ $PYTHON -c " import irods.client_init; irods.client_init.write_native_credentials_to_secrets_file('rods')"
32+
33+
34+ # Define the core Python to be run, basically a minimal code block ensuring that we can authenticate to iRODS
35+ # without an exception being raised.
36+
37+ local SCRIPT="
38+ import irods.test.helpers as h
39+ ses = h.make_session()
40+ ses.collections.get(h.home_collection(ses))
41+ print ('env_auth_scheme=%s' % ses.pool.account._original_authentication_scheme)
42+ "
43+ OUTPUT=$( $PYTHON -c " $SCRIPT " )
44+ # Assert passing value
45+ [ $OUTPUT = env_auth_scheme= native ]
46+ }
You can’t perform that action at this time.
0 commit comments