Skip to content

Commit

Permalink
[_517] tests
Browse files Browse the repository at this point in the history
  • Loading branch information
d-w-moore committed Oct 1, 2024
1 parent e564bff commit 43eae50
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
44 changes: 44 additions & 0 deletions irods/test/scripts/test002.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env bats

. "$BATS_TEST_DIRNAME"/funcs
PYTHON=python3

# Setup/prerequisites are same as for login_auth_test.
# Run as ubuntu user with sudo; python_irodsclient must be installed (in either ~/.local or a virtualenv)
#

PASSWD=test123
NEW_PAM_PASSWD="new_pass"

setup()
{
setup_pam_login_for_alice $PASSWD
}

teardown()
{
finalize_pam_login_for_alice
test_specific_cleanup
}

@test create_secrets_file {

sudo chpasswd <<<"alice:$NEW_PAM_PASSWD"
rm -f ~/.irods/.irodsA
$PYTHON -c "import irods.client_init; irods.client_init.write_pam_credentials_to_secrets_file('$NEW_PAM_PASSWD')"


# Define the core Python to be run, basically a minimal code block ensuring that we can authenticate to iRODS
# without an exception being raised.

local SCRIPT="
import irods.test.helpers as h
ses = h.make_session()
ses.collections.get(h.home_collection(ses))
print ('env_auth_scheme=%s' % ses.pool.account._original_authentication_scheme)
"
OUTPUT=$($PYTHON -c "$SCRIPT")
# Assert passing value
[ $OUTPUT = env_auth_scheme=pam_password ]

}
46 changes: 46 additions & 0 deletions irods/test/scripts/test003.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env bats

. "$BATS_TEST_DIRNAME"/funcs
PYTHON=python3

# Setup/prerequisites are same as for login_auth_test.
# Run as ubuntu user with sudo; python_irodsclient must be installed (in either ~/.local or a virtualenv)
#

setup()
{
:
}

teardown()
{
:
}

@test create_irods_secrets_file {

rm -fr ~/.irods
mkdir ~/.irods
cat > ~/.irods/irods_environment.json <<-EOF
{ "irods_host":"$(hostname)",
"irods_port":1247,
"irods_user_name":"rods",
"irods_zone_name":"tempZone"
}
EOF
$PYTHON -c "import irods.client_init; irods.client_init.write_native_credentials_to_secrets_file('rods')"


# Define the core Python to be run, basically a minimal code block ensuring that we can authenticate to iRODS
# without an exception being raised.

local SCRIPT="
import irods.test.helpers as h
ses = h.make_session()
ses.collections.get(h.home_collection(ses))
print ('env_auth_scheme=%s' % ses.pool.account._original_authentication_scheme)
"
OUTPUT=$($PYTHON -c "$SCRIPT")
# Assert passing value
[ $OUTPUT = env_auth_scheme=native ]
}

0 comments on commit 43eae50

Please sign in to comment.