Update tests for modified code, and for CSRF checks.
This commit is contained in:
parent
754fe6a800
commit
8dcd511a8b
7 changed files with 36 additions and 18 deletions
|
|
@ -143,10 +143,10 @@ is($newDriver->get('label'), 'Cold, stone hard cash', 'label passed correctly to
|
|||
my $drivers = $pay->getDrivers();
|
||||
|
||||
my $defaultPayDrivers = {
|
||||
'WebGUI::Shop::PayDriver::Cash' => 'Cash',
|
||||
'WebGUI::Shop::PayDriver::ITransact' => 'Credit Card (ITransact)',
|
||||
'WebGUI::Shop::PayDriver::PayPal::PayPalStd' => 'PayPal',
|
||||
'WebGUI::Shop::PayDriver::Ogone' => 'Ogone',
|
||||
'WebGUI::Shop::PayDriver::Cash' => 'Cash',
|
||||
'WebGUI::Shop::PayDriver::ITransact' => 'Credit Card (ITransact)',
|
||||
'WebGUI::Shop::PayDriver::PayPal' => 'PayPal',
|
||||
'WebGUI::Shop::PayDriver::Ogone' => 'Ogone',
|
||||
};
|
||||
|
||||
cmp_deeply( $drivers, $defaultPayDrivers, 'getDrivers returns the default PayDrivers');
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ my @forms = HTML::Form->parse($html, 'http://www.webgui.org');
|
|||
is (scalar @forms, 1, 'getEditForm generates just 1 form');
|
||||
|
||||
my @inputs = $forms[0]->inputs;
|
||||
is (scalar @inputs, 13, 'getEditForm: the form has 13 controls');
|
||||
is (scalar @inputs, 14, 'getEditForm: the form has 14 controls');
|
||||
|
||||
my @interestingFeatures;
|
||||
foreach my $input (@inputs) {
|
||||
|
|
@ -298,6 +298,10 @@ foreach my $input (@inputs) {
|
|||
cmp_deeply(
|
||||
\@interestingFeatures,
|
||||
[
|
||||
{
|
||||
name => 'webguiCsrfToken',
|
||||
type => 'hidden',
|
||||
},
|
||||
{
|
||||
name => undef,
|
||||
type => 'submit',
|
||||
|
|
|
|||
|
|
@ -372,7 +372,7 @@ my @forms = HTML::Form->parse($html, 'http://www.webgui.org');
|
|||
is (scalar @forms, 1, 'getEditForm generates just 1 form');
|
||||
|
||||
my @inputs = $forms[0]->inputs;
|
||||
is (scalar @inputs, 19, 'getEditForm: the form has 19 controls');
|
||||
is (scalar @inputs, 20, 'getEditForm: the form has 20 controls');
|
||||
|
||||
my @interestingFeatures;
|
||||
foreach my $input (@inputs) {
|
||||
|
|
@ -381,9 +381,15 @@ foreach my $input (@inputs) {
|
|||
push @interestingFeatures, { name => $name, type => $type };
|
||||
}
|
||||
|
||||
diag Dumper \@interestingFeatures;
|
||||
|
||||
cmp_deeply(
|
||||
\@interestingFeatures,
|
||||
[
|
||||
{
|
||||
name => 'webguiCsrfToken',
|
||||
type => 'hidden',
|
||||
},
|
||||
{
|
||||
name => undef,
|
||||
type => 'submit',
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
use FindBin;
|
||||
use strict;
|
||||
use lib "$FindBin::Bin/../../../lib";
|
||||
use lib "$FindBin::Bin/../../lib";
|
||||
use Test::More;
|
||||
use Test::Deep;
|
||||
use JSON;
|
||||
|
|
@ -39,13 +39,13 @@ plan tests => 1 + $tests;
|
|||
|
||||
my $e;
|
||||
|
||||
my $loaded = use_ok('WebGUI::Shop::PayDriver::PayPal::PayPalStd');
|
||||
my $loaded = use_ok('WebGUI::Shop::PayDriver::PayPal');
|
||||
|
||||
my $storage;
|
||||
|
||||
SKIP: {
|
||||
|
||||
skip 'Unable to load module WebGUI::Shop::PayDriver::PayPal::PayPalStd', $tests unless $loaded;
|
||||
skip 'Unable to load module WebGUI::Shop::PayDriver::PayPal', $tests unless $loaded;
|
||||
|
||||
#######################################################################
|
||||
#
|
||||
|
|
@ -60,10 +60,10 @@ my $options = {
|
|||
receiptMessage => 'Pannenkoeken zijn nog lekkerder met spek',
|
||||
};
|
||||
|
||||
$driver = WebGUI::Shop::PayDriver::PayPal::PayPalStd->create( $session, $options );
|
||||
$driver = WebGUI::Shop::PayDriver::PayPal->create( $session, $options );
|
||||
|
||||
isa_ok ($driver, 'WebGUI::Shop::PayDriver');
|
||||
isa_ok ($driver, 'WebGUI::Shop::PayDriver::PayPal::PayPalStd');
|
||||
isa_ok ($driver, 'WebGUI::Shop::PayDriver::PayPal');
|
||||
|
||||
is($driver->getName($session), 'PayPal', 'getName returns the human readable name of this driver');
|
||||
|
||||
|
|
@ -223,7 +223,7 @@ my @forms = HTML::Form->parse($html, 'http://www.webgui.org');
|
|||
is (scalar @forms, 1, 'getEditForm generates just 1 form');
|
||||
|
||||
my @inputs = $forms[0]->inputs;
|
||||
is (scalar @inputs, 9, 'getEditForm: the form has 9 controls');
|
||||
is (scalar @inputs, 10, 'getEditForm: the form has 10 controls');
|
||||
|
||||
my @interestingFeatures;
|
||||
foreach my $input (@inputs) {
|
||||
|
|
@ -235,6 +235,10 @@ foreach my $input (@inputs) {
|
|||
cmp_deeply(
|
||||
\@interestingFeatures,
|
||||
[
|
||||
{
|
||||
name => 'webguiCsrfToken',
|
||||
type => 'hidden',
|
||||
},
|
||||
{
|
||||
name => undef,
|
||||
type => 'submit',
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ my @forms = HTML::Form->parse($html, 'http://www.webgui.org');
|
|||
is (scalar @forms, 1, 'getEditForm generates just 1 form');
|
||||
|
||||
my @inputs = $forms[0]->inputs;
|
||||
is (scalar @inputs, 13, 'getEditForm: the form has 13 controls');
|
||||
is (scalar @inputs, 14, 'getEditForm: the form has 14 controls');
|
||||
|
||||
my @interestingFeatures;
|
||||
foreach my $input (@inputs) {
|
||||
|
|
@ -185,6 +185,10 @@ foreach my $input (@inputs) {
|
|||
cmp_deeply(
|
||||
\@interestingFeatures,
|
||||
[
|
||||
{
|
||||
name => 'webguiCsrfToken',
|
||||
type => 'hidden',
|
||||
},
|
||||
{
|
||||
name => undef,
|
||||
type => 'submit',
|
||||
|
|
|
|||
|
|
@ -52,6 +52,9 @@ my $origSessionTimeout = $session->setting->get('sessionTimeout');
|
|||
my $sessionCount = $session->db->quickScalar('select count(*) from userSession');
|
||||
my $scratchCount = $session->db->quickScalar('select count(*) from userSessionScratch');
|
||||
|
||||
diag $sessionCount;
|
||||
diag $scratchCount;
|
||||
|
||||
my @sessions;
|
||||
|
||||
foreach (1..2) {
|
||||
|
|
@ -67,14 +70,11 @@ foreach (1..2) {
|
|||
|
||||
$session->setting->set('sessionTimeout', $origSessionTimeout );
|
||||
|
||||
$sessions[1]->scratch->set('scratch1', 1);
|
||||
$sessions[3]->scratch->set('scratch3', 3);
|
||||
|
||||
my $newSessionCount = $session->db->quickScalar('select count(*) from userSession');
|
||||
my $newScratchCount = $session->db->quickScalar('select count(*) from userSessionScratch');
|
||||
|
||||
is ($newSessionCount, $sessionCount+4, 'all new sessions created correctly');
|
||||
is ($newScratchCount, $scratchCount+2, 'two of the new sessions have scratch entries');
|
||||
is ($newScratchCount, $scratchCount+4, 'all new user sessions created correctly');
|
||||
|
||||
my $instance2 = WebGUI::Workflow::Instance->create($session,
|
||||
{
|
||||
|
|
@ -95,7 +95,7 @@ $newSessionCount = $session->db->quickScalar('select count(*) from userSession')
|
|||
$newScratchCount = $session->db->quickScalar('select count(*) from userSessionScratch');
|
||||
|
||||
is ($newSessionCount, $sessionCount+2, 'two of the sessions were deleted');
|
||||
is ($newScratchCount, $scratchCount+1, 'one of the new sessions have scratch entries were deleted');
|
||||
is ($newScratchCount, $scratchCount+2, 'scratch from both sessions cleaned up');
|
||||
|
||||
foreach my $testSession (@sessions) {
|
||||
$testSession->var->end;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue