Skip to content

Commit

Permalink
Use latest JsonRpcController to hide exceptions from frontend/user (#213
Browse files Browse the repository at this point in the history
)

* Use latest JsonRpcController to hide exceptions from frontend/user
* Add Test::Fatal to requirements
  • Loading branch information
zaucker authored Feb 28, 2023
1 parent 8d57d1e commit 559801c
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ WriteMakefile(
LICENSE => 'gpl_3',
PREREQ_PM => {
'Mojolicious' => '9.12',
'Mojolicious::Plugin::Qooxdoo' => '1.0.13',
'Mojolicious::Plugin::Qooxdoo' => '1.0.14',
'Config::Grammar' => '1.13',
'XS::Parse::Keyword' => '0.21',
'Future::AsyncAwait' => '0.54',
Expand All @@ -23,6 +23,7 @@ WriteMakefile(
'YAML::XS' => 0.83,
'Text::CSV' => 0,
'Excel::Writer::XLSX' => 0,
'Test::Fatal' => 0,
},
BUILD_REQUIRES => {
'CPAN::Uploader' => 0
Expand Down
2 changes: 1 addition & 1 deletion t/basic.t
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ for (1..2){
}
$ENV{CALLBACKERY_RPC_LOG}=0;

my $c = p1->new;
my $c = p1->new(app => $t->app);

my $data = {
k => { lalala => '123' }
Expand Down
39 changes: 39 additions & 0 deletions t/invalidPlugin.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
use FindBin;

use lib $FindBin::Bin.'/../thirdparty/lib/perl5';
use lib $FindBin::Bin.'/../lib';

use Mojo::Base -strict;

use Test::More;
use Test::Mojo;

$ENV{CALLBACKERY_CONF} = $FindBin::Bin.'/callbackery.cfg';

my $t = Test::Mojo->new('CallBackery');

$t->post_ok('/QX-JSON-RPC' => json => {
service => 'default',
method=> 'processPluginData',
id => 1,
params => [
"undefinedPlugin", {
key => 'randomKey',
formData => {
}
},
{ qxLocale => 'de' }
]
})
->status_is(200, 'processPluginData of undefinedPlugin returns 200')
->json_is('' => {
id => 1,
error => {
origin => 2,
code => 9999,
message => "Couldn't process request",
}
}, 'Got correct error handling from JsonRPcController');

done_testing;
exit;

0 comments on commit 559801c

Please sign in to comment.