Skip to content

Commit b8d438c

Browse files
d-w-moorealanking
authored andcommitted
[#655] swap test filenames
1 parent b459928 commit b8d438c

2 files changed

Lines changed: 35 additions & 35 deletions

File tree

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bats
22
#
33
# Test creation of .irodsA for iRODS native authentication using the free function,
4-
# irods.client_init.write_pam_credentials_to_secrets_file
4+
# irods.client_init.write_native_credentials_to_secrets_file
55

66
. "$BATS_TEST_DIRNAME"/test_support_functions
77
PYTHON=python3
@@ -10,26 +10,18 @@ PYTHON=python3
1010
# Run as ubuntu user with sudo; python_irodsclient must be installed (in either ~/.local or a virtualenv)
1111
#
1212

13-
ALICES_OLD_PAM_PASSWD="test123"
14-
ALICES_NEW_PAM_PASSWD="new_pass"
13+
@test create_irods_secrets_file {
1514

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')"
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')"
3325

3426
# Define the core Python to be run, basically a minimal code block ensuring that we can authenticate to iRODS
3527
# without an exception being raised.
@@ -42,6 +34,5 @@ print ('env_auth_scheme=%s' % ses.pool.account._original_authentication_scheme)
4234
"
4335
OUTPUT=$($PYTHON -c "$SCRIPT")
4436
# Assert passing value
45-
[ $OUTPUT = "env_auth_scheme=pam_password" ]
46-
37+
[ $OUTPUT = "env_auth_scheme=native" ]
4738
}
Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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
77
PYTHON=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

Comments
 (0)