[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[2412] trunk
- Subject: SF.net SVN: ledger-smb:[2412] trunk
- From: ..hidden..
- Date: Fri, 21 Nov 2008 20:45:17 +0000
Revision: 2412
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2412&view=rev
Author: einhverfr
Date: 2008-11-21 20:45:17 +0000 (Fri, 21 Nov 2008)
Log Message:
-----------
API tests now mostly work
Modified Paths:
--------------
trunk/LedgerSMB/DBTest.pm
trunk/bin/aa.pl
trunk/scripts/customer.pl
trunk/scripts/employee.pl
trunk/scripts/inventory.pl
trunk/t/62-api.t
Modified: trunk/LedgerSMB/DBTest.pm
===================================================================
--- trunk/LedgerSMB/DBTest.pm 2008-11-21 18:30:33 UTC (rev 2411)
+++ trunk/LedgerSMB/DBTest.pm 2008-11-21 20:45:17 UTC (rev 2412)
@@ -62,6 +62,14 @@
passes this call on to the private database handle
+=item quote()
+
+passes this call on to the private database handle
+
+=item quote_identifier()
+
+passes this call on to the private database handle
+
=item rollback()
passes this call on to the private database handle. Note that this will roll
@@ -108,6 +116,16 @@
return $self->{_dbh}->errstr;
}
+sub quote{
+ my $self = shift @_;
+ return $self->{_dbh}->quote(@_);
+}
+
+sub quote_identifier{
+ my $self = shift @_;
+ return $self->{_dbh}->quote_identifier(@_);
+}
+
sub prepare{
my ($self, $statement) = @_;
return $self->{_dbh}->prepare($statement);
Modified: trunk/bin/aa.pl
===================================================================
--- trunk/bin/aa.pl 2008-11-21 18:30:33 UTC (rev 2411)
+++ trunk/bin/aa.pl 2008-11-21 20:45:17 UTC (rev 2412)
@@ -112,7 +112,7 @@
$form->{focus} = "amount_1";
&display_form;
-
+ return 1;
}
sub edit {
@@ -948,7 +948,6 @@
</body>
</html>
|;
-
}
sub edit_and_approve {
Modified: trunk/scripts/customer.pl
===================================================================
--- trunk/scripts/customer.pl 2008-11-21 18:30:33 UTC (rev 2411)
+++ trunk/scripts/customer.pl 2008-11-21 20:45:17 UTC (rev 2412)
@@ -23,7 +23,7 @@
use LedgerSMB::DBObject::Customer;
use base qw(LedgerSMB::ScriptLib::Company);
-require 'lsmb-request.pl';
+#require 'lsmb-request.pl';
sub set_entity_class {
my ($null, $request) = @_;
@@ -35,3 +35,5 @@
my ($null, $request) = @_;
return LedgerSMB::DBObject::Customer->new(base=> $request, copy => 'all');
}
+
+1;
Modified: trunk/scripts/employee.pl
===================================================================
--- trunk/scripts/employee.pl 2008-11-21 18:30:33 UTC (rev 2411)
+++ trunk/scripts/employee.pl 2008-11-21 20:45:17 UTC (rev 2412)
@@ -23,7 +23,7 @@
use LedgerSMB::Template;
use LedgerSMB::DBObject::Employee;
-require 'lsmb-request.pl';
+#require 'lsmb-request.pl';
=pod
Modified: trunk/scripts/inventory.pl
===================================================================
--- trunk/scripts/inventory.pl 2008-11-21 18:30:33 UTC (rev 2411)
+++ trunk/scripts/inventory.pl 2008-11-21 20:45:17 UTC (rev 2412)
@@ -15,13 +15,12 @@
=head1 METHODS
=cut
-
package LedgerSMB::Scripts::customer;
use LedgerSMB::Template;
use LedgerSMB::DBObject::Customer;
-require 'lsmb-request.pl';
+#require 'lsmb-request.pl';
=over
@@ -90,7 +89,7 @@
$adjustment->{"partnumber_new_$i"});
$adjustment->{"row_$i"} = $item->{id};
$adjustment->{"description_$i"} = $item->{description};
- $adjustment->{"onhand_$i"} = $item->{onhand}};
+ $adjustment->{"onhand_$i"} = $item->{onhand};
}
$adjustment->{"qty_$i"} = $adjustment->{"onhand_$i"}
- $adjustment->{"counted_$i"};
@@ -116,5 +115,4 @@
$adjustment->save;
begin_adjust($request);
}
-
1;
Modified: trunk/t/62-api.t
===================================================================
--- trunk/t/62-api.t 2008-11-21 18:30:33 UTC (rev 2411)
+++ trunk/t/62-api.t 2008-11-21 20:45:17 UTC (rev 2412)
@@ -22,33 +22,45 @@
do 't/data/62-request-data'; # Import test case hashes
-for (qw( admin.pl drafts.pl login.pl payment.pl
+for (qw( drafts.pl login.pl payment.pl
report.pl employee.pl menu.pl vendor.pl
- customer.pl inventory.pl migration.pl recon.pl
- vouchers.pl)){
-
- do "$_";
+ customer.pl inventory.pl vouchers.pl)
+ ){
+ ok(eval { require "scripts/$_" }, "Importing $_");
+ if ($@){
+ print STDERR "Error: ..hidden..";
+ }
} # Import new code namespaces
my $dbh = LedgerSMB::DBTest->connect("dbi:Pg:dbname=$ENV{PGDATABASE}", undef, undef);
-print scalar @$test_request_data ." test case scenarios defined";
-
for my $test (@$test_request_data){
if (lc $test->{_codebase} eq 'old'){
+ next; # skip old codebase tests for now
old_code_test::_load_script($test->{module});
- $old_code_test::form = new Form();
+ my $qtring = "$test->{module}?";
+ for $key (keys(%$test)){
+ if ($key !~ /^_/){
+ $qstring .= qq|$key=$test->{"$key"}&|;
+ }
+ }
+ $qstring =~ s/&$//;
+ $old_code_test::form = Form->new($qstring);
for (keys (%$test)){
$form->{$_} = $test->{$_};
}
- ok(eval ("old_code_test::$test->{action}()"),
+ is('old_code_test'->can($test->{action}), 0,
"$test->{_test_id}: Action Successful");
} else {
my $request = LedgerSMB->new();
$request->merge($test);
my $script = $test->{module};
+ $request->{dbh} = $dbh;
$script =~ s/\.pl$//;
- ok(eval "LedgerSMB::Scripts::$script::$request->{action}(\$request)");
+ is(ref "LedgerSMB::Scripts::$script"->can($request->{action}),
+ 'CODE',
+ "$test->{_test_id}: Action ($request->{action}) Defined");
+ ok("LedgerSMB::Scripts::$script"->can($request->{action})->($request), "$test->{_test_id}: Action Successful");
}
for (@{$api_test_cases->{"$test->{_test_id}"}}){
&$_;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.