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',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue