-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add CRMS#extract_env_email and tests * Iterate on possible multiple ENV{email} values to identify remote user. * Tidy CRMS#SetupUser
- Loading branch information
Showing
2 changed files
with
68 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,29 @@ subtest '#Version' => sub { | |
ok($crms->Version); | ||
}; | ||
|
||
subtest '#extract_env_email' => sub { | ||
my $tests = [ | ||
# Each is [INPUT, OUTPUT, TEST_COMMENT] | ||
[undef, [], 'empty array if no email defined'], | ||
['', [], 'empty array if empty string'], | ||
['[email protected]', ['[email protected]'], 'extracts single value'], | ||
['[email protected];[email protected]', ['[email protected]', '[email protected]'], 'extracts multiple values'], | ||
[';[email protected]', ['[email protected]'], 'ignores leading semicolon'], | ||
['[email protected];', ['[email protected]'], 'ignores trailing semicolon'], | ||
['[email protected]', ['someone'], 'strips @umich.edu'], | ||
['[email protected];[email protected]', ['[email protected]'], 'merges duplicates'], | ||
['[email protected]', ['[email protected]'], 'downcases'] | ||
]; | ||
my $save_email = $ENV{email}; | ||
delete $ENV{email}; | ||
foreach my $test (@$tests) { | ||
is_deeply($crms->extract_env_email($test->[0]), $test->[1], $test->[2]); | ||
} | ||
$ENV{email} = '[email protected]'; | ||
is_deeply($crms->extract_env_email, ['[email protected]'], 'uses ENV{email} if no parameter'); | ||
$ENV{email} = $save_email; | ||
}; | ||
|
||
subtest 'CRMS::MoveToHathitrustFiles' => sub { | ||
my $tempdir = File::Temp::tempdir(CLEANUP => 1); | ||
my $save_hathitrust_files_directory = $ENV{'CRMS_HATHITRUST_FILES_DIRECTORY'}; | ||
|