-
Notifications
You must be signed in to change notification settings - Fork 1
ETT-1394 address warning: "CGI::Param called in list context" #234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
moseshll
wants to merge
6
commits into
main
Choose a base branch
from
ETT-1394_cgi_param_list_context
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+144
−8
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b14e630
ETT-1394 address warning: "CGI::Param called in list context"
moseshll c46fde0
- Address issue in `LS::PIFiller::ListSearchResults`
moseshll f6b9210
- Address and test issues in `MBooks::PIFiller::ListUtils::handle_ANA…
moseshll 921d368
- Address issue in `MBooks::Operation::LogoutTrap::redirect_and_exit`
moseshll 98976f1
- Address issue in `PT::Prolog::Run`
moseshll a995ae8
- Use a signal handler to accumulate Perl warnings and assert that th…
moseshll File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| use Test::More; | ||
| use UUID::Tiny; | ||
|
|
||
| use Auth::Auth; | ||
| use Data::Dumper; | ||
|
|
||
| use lib "$ENV{SDRROOT}/ls/lib"; | ||
| use lib "$ENV{SDRROOT}/slip-lib"; | ||
| use lib "$ENV{SDRROOT}/mdp-lib"; | ||
| use lib "$ENV{SDRROOT}/mdp-lib/t/lib"; | ||
| use LS::PIFiller::ListSearchResults; | ||
| #use Collection; | ||
|
|
||
|
|
||
| my $C = new Context; | ||
| my $cgi = new CGI; | ||
| $C->set_object('CGI', $cgi); | ||
| my $config = new MdpConfig(File::Spec->catdir($ENV{SDRROOT}, 'mdp-lib/Config/uber.conf'), | ||
| File::Spec->catdir($ENV{SDRROOT}, 'slip-lib/Config/common.conf')); | ||
| $C->set_object('MdpConfig', $config); | ||
|
|
||
| my $db_user = $ENV{'MARIADB_USER'} || 'ht_testing'; | ||
| my $db = new Database($db_user); | ||
| $C->set_object('Database', $db); | ||
|
|
||
| my $dbh = $db->get_DBH; | ||
| $C->set_object('DBI', $dbh); | ||
|
|
||
| #my $auth = Auth::Auth->new($C); | ||
| #$C->set_object( 'Auth', $auth ); | ||
|
|
||
| # Track warnings. We don't want any. They clutter the logs. | ||
| my @warnings; | ||
| local $SIG{__WARN__} = sub { | ||
| my $message = shift; | ||
| print STDERR $message; | ||
| push @warnings, $message; | ||
| }; | ||
|
|
||
| subtest "handle_ANALYTICS_REPORT_URL_PI" => sub { | ||
| # FIXME: find realistic examples of this, not copies of the collection builder tests | ||
| subtest "with a collection ID" => sub { | ||
| my $cgi = $C->get_object('CGI'); | ||
| # Given a query q1=something&sort=cn_a&colltype=featured&a=listcs | ||
| # The analytics URL should be /mb/listcs/?q1=something&sort=cn_a | ||
| # This seems kind of brittle because handle_ANALYTICS_REPORT_URL_PI relies on CGI | ||
| # for the ordering of parameters when constructing the URL. There's no explicit sorting. | ||
| $cgi->param('c', '123'); | ||
| $cgi->param('q1', 'something'); | ||
| $cgi->param('sort', 'cn_a'); | ||
| $cgi->param('colltype', 'featured'); | ||
| $cgi->param('lmt', '10'); | ||
| my $res = LS::PIFiller::ListSearchResults::handle_ANALYTICS_REPORT_URL_PI($C, '', {}); | ||
| is($res, "/ls/listis/123/10?q1=something&lmt=10"); | ||
| # Clean up | ||
| $C->set_object('CGI', new CGI); | ||
| }; | ||
|
|
||
| subtest "without a collection ID" => sub { | ||
| my $cgi = $C->get_object('CGI'); | ||
| # Given a query q1=something&sort=cn_a&colltype=featured&a=listcs | ||
| # The analytics URL should be /mb/listcs/?q1=something&sort=cn_a | ||
| # This seems kind of brittle because handle_ANALYTICS_REPORT_URL_PI relies on CGI | ||
| # for the ordering of parameters when constructing the URL. There's no explicit sorting. | ||
| $cgi->param('q1', 'something'); | ||
| $cgi->param('sort', 'cn_a'); | ||
| $cgi->param('colltype', 'featured'); | ||
| $cgi->param('a', 'listcs'); | ||
| my $res = LS::PIFiller::ListSearchResults::handle_ANALYTICS_REPORT_URL_PI($C, '', {}); | ||
| is($res, "/ls/listcs?q1=something"); | ||
| # Clean up | ||
| $C->set_object('CGI', new CGI); | ||
| }; | ||
| }; | ||
|
|
||
| subtest 'check for accumulated warnings' => sub { | ||
| is(scalar @warnings, 0, 'no warnings encountered'); | ||
| }; | ||
|
|
||
| done_testing(); |
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| use Test::More; | ||
| use UUID::Tiny; | ||
|
|
||
| use Auth::Auth; | ||
| use Data::Dumper; | ||
|
|
||
| use lib "$ENV{SDRROOT}/mb/lib"; | ||
| use lib "$ENV{SDRROOT}/slip-lib"; | ||
| use MBooks::PIFiller::ListUtils; | ||
| use Collection; | ||
|
|
||
|
|
||
| my $C = new Context; | ||
| my $cgi = new CGI; | ||
| $C->set_object('CGI', $cgi); | ||
| my $config = new MdpConfig(File::Spec->catdir($ENV{SDRROOT}, 'mdp-lib/Config/uber.conf'), | ||
| File::Spec->catdir($ENV{SDRROOT}, 'slip-lib/Config/common.conf')); | ||
| $C->set_object('MdpConfig', $config); | ||
|
|
||
| my $db_user = $ENV{'MARIADB_USER'} || 'ht_testing'; | ||
| my $db = new Database($db_user); | ||
| $C->set_object('Database', $db); | ||
|
|
||
| my $dbh = $db->get_DBH; | ||
| $C->set_object('DBI', $dbh); | ||
|
|
||
| #my $auth = Auth::Auth->new($C); | ||
| #$C->set_object( 'Auth', $auth ); | ||
|
|
||
| # Track warnings. We don't want any. They clutter the logs. | ||
| my @warnings; | ||
| local $SIG{__WARN__} = sub { | ||
| my $message = shift; | ||
| print STDERR $message; | ||
| push @warnings, $message; | ||
| }; | ||
|
|
||
| subtest "handle_ANALYTICS_REPORT_URL_PI" => sub { | ||
| # Given a query a=listis&c=123&sort=title_d | ||
| # The analytics URL should be /mb/listcs/<COLLID>?q1=something&sort=cn_a | ||
| # This seems kind of brittle because handle_ANALYTICS_REPORT_URL_PI relies on CGI | ||
| # for the ordering of parameters when constructing the URL. There's no explicit sorting. | ||
| $cgi->param('a', 'listis'); | ||
| $cgi->param('c', '123'); | ||
| $cgi->param('sort', 'title_d'); | ||
| my $res = MBooks::PIFiller::ListUtils::handle_ANALYTICS_REPORT_URL_PI($C, '', {}); | ||
| is($res, '/mb/listis/123?sort=title_d'); | ||
| # Clean up | ||
| $C->set_object('CGI', new CGI); | ||
| }; | ||
|
|
||
| subtest 'check for accumulated warnings' => sub { | ||
| is(scalar @warnings, 0, 'no warnings encountered'); | ||
| }; | ||
|
|
||
| done_testing(); |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could just call
scalarhere. I don't know if it is possible to ever have multiple values for the params referenced above, and additionally I don't know if it matters for the analytics report URL, or indeed if we even care.