File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,11 +25,27 @@ teardown()
2525}
2626
2727@test create_secrets_file {
28+ auth_file=~ /.irods/.irodsA
2829
29- # Old .irodsA is already created, so we delete it and alter the pam password.
30+ CONTENTS1=$( cat $auth_file )
31+
32+ # Alter the pam password.
3033 sudo chpasswd <<< " alice:$ALICES_NEW_PAM_PASSWD"
31- rm -f ~ /.irods/.irodsA
34+ OUTPUT=$( $PYTHON -c " import irods.client_init;
35+ try:
36+ irods.client_init.write_pam_credentials_to_secrets_file('$ALICES_NEW_PAM_PASSWD ', overwrite = False)
37+ except irods.client_init.irodsA_already_exists:
38+ print ('CANNOT OVERWRITE')
39+ " )
40+ [ " $OUTPUT " = " CANNOT OVERWRITE" ]
41+ # Assert the previous contents of irodsA have not changed, and aren't zero length.
42+ CONTENTS2=$( cat $auth_file )
43+ [ -n " $CONTENTS1 " -a " $CONTENTS1 " = " $CONTENTS2 " ]
44+
45+ # Now delete the already existing irodsA and repeat without negating overwrite.
3246 $PYTHON -c " import irods.client_init; irods.client_init.write_pam_credentials_to_secrets_file('$ALICES_NEW_PAM_PASSWD ')"
47+ CONTENTS3=$( cat $auth_file )
48+ [ " $CONTENTS2 " != " $CONTENTS3 " ]
3349
3450 # Define the core Python to be run, basically a minimal code block ensuring that we can authenticate to iRODS
3551 # without an exception being raised.
You can’t perform that action at this time.
0 commit comments