-
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
7 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 3d3e25d
- Check for warnings at the (sub)subtest level.
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,68 @@ | ||
| 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 ); | ||
|
|
||
| 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); | ||
| }; | ||
| }; | ||
|
|
||
| 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,44 @@ | ||
| 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 ); | ||
|
|
||
| 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); | ||
| }; | ||
|
|
||
| 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.
Uh oh!
There was an error while loading. Please reload this page.