[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[5089] branches/1.3



Revision: 5089
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5089&view=rev
Author:   einhverfr
Date:     2012-08-04 02:04:57 +0000 (Sat, 04 Aug 2012)
Log Message:
-----------
Adding script for pre-release tests so people can use this to test their own installations and suggest additional tests
Also the existing success test for loading files was broken.  Added new tests for this, and fixed load failures found.
Finally corrected other test failures found through this process.

Modified Paths:
--------------
    branches/1.3/LedgerSMB/Database.pm
    branches/1.3/sql/modules/Parts.sql
    branches/1.3/sql/modules/test/Reconciliation.sql
    branches/1.3/t/04-template-handling.t
    branches/1.3/t/40-dbsetup.t

Added Paths:
-----------
    branches/1.3/tools/pre-release-tests.sh

Modified: branches/1.3/LedgerSMB/Database.pm
===================================================================
--- branches/1.3/LedgerSMB/Database.pm	2012-08-04 01:04:36 UTC (rev 5088)
+++ branches/1.3/LedgerSMB/Database.pm	2012-08-04 02:04:57 UTC (rev 5089)
@@ -292,7 +292,7 @@
            } else {
                 $retval->{status} = 'does not exist';
            }
-           my $sth = $dbh->prepare("SELECT SESSION_USER");
+           $sth = $dbh->prepare("SELECT SESSION_USER");
            $sth->execute;
            $retval->{username} = $sth->fetchrow_array();
            return $retval;

Modified: branches/1.3/sql/modules/Parts.sql
===================================================================
--- branches/1.3/sql/modules/Parts.sql	2012-08-04 01:04:36 UTC (rev 5088)
+++ branches/1.3/sql/modules/Parts.sql	2012-08-04 02:04:57 UTC (rev 5089)
@@ -8,9 +8,9 @@
   FROM parts 
  WHERE ($1 IS NULL OR (partnumber like $1 || '%'))
        AND ($2 IS NULL 
-            OR (to_tsvector(get_default_lang()::name, description) 
+            OR (description
                 @@
-                plainto_tsquery(get_default_lang()::name, $2)))
+                plainto_tsquery(get_default_lang()::regconfig, $2)))
        AND not obsolete
 ORDER BY partnumber;
 $$ LANGUAGE SQL;

Modified: branches/1.3/sql/modules/test/Reconciliation.sql
===================================================================
--- branches/1.3/sql/modules/test/Reconciliation.sql	2012-08-04 01:04:36 UTC (rev 5088)
+++ branches/1.3/sql/modules/test/Reconciliation.sql	2012-08-04 02:04:57 UTC (rev 5089)
@@ -11,7 +11,7 @@
 
 INSERT INTO test_result(test_name, success)
 SELECT 'Create Recon Report', 
-	reconciliation__new_report_id(test_get_account_id('-11111'), 100, now()::date) > 0;
+	reconciliation__new_report_id(test_get_account_id('-11111'), 100, now()::date, 'f') > 0;
 
 INSERT INTO test_result(test_name, success)
 SELECT 'Pending Transactions Ran', reconciliation__pending_transactions(now()::date, test_get_account_id('-11111'), currval('cr_report_id_seq')::int, 110) > 0;
@@ -43,7 +43,7 @@
 
 INSERT INTO test_result(test_name, success)
 SELECT '1 Create Recon Report', 
-	reconciliation__new_report_id(test_get_account_id('-11112'), 100, now()::date) > 0;
+	reconciliation__new_report_id(test_get_account_id('-11112'), 100, now()::date, 'f') > 0;
 
 INSERT INTO test_result(test_name, success)
 SELECT '1 Pending Transactions Ran', reconciliation__pending_transactions(now()::date, test_get_account_id('-11112'), currval('cr_report_id_seq')::int, 110) > 0;
@@ -87,7 +87,7 @@
 
 INSERT INTO test_result(test_name, success)
 SELECT '1 Create Recon Report', 
-	reconciliation__new_report_id(test_get_account_id('-11112'), 100, now()::date) > 0;
+	reconciliation__new_report_id(test_get_account_id('-11112'), 100, now()::date, 'f') > 0;
 
 INSERT INTO test_result(test_name, success)
 SELECT '1 Pending Transactions Ran', reconciliation__pending_transactions(now()::date, test_get_account_id('-11112'), currval('cr_report_id_seq')::int, 110) > 0;

Modified: branches/1.3/t/04-template-handling.t
===================================================================
--- branches/1.3/t/04-template-handling.t	2012-08-04 01:04:36 UTC (rev 5088)
+++ branches/1.3/t/04-template-handling.t	2012-08-04 02:04:57 UTC (rev 5089)
@@ -136,7 +136,7 @@
 @r = trap{AM->check_template_name($myconfig, $form)};
 if ( $expStackTrace == 0 )
 {
-    is($trap->die, "Error: Directory transversal not allowed.\n",
+    is($trap->die, "Error: Not in a whitelisted directory: /tmp/apples.txt\n",
         'AM, check_template_name: Directory transversal denial 2');
 }
 else

Modified: branches/1.3/t/40-dbsetup.t
===================================================================
--- branches/1.3/t/40-dbsetup.t	2012-08-04 01:04:36 UTC (rev 5088)
+++ branches/1.3/t/40-dbsetup.t	2012-08-04 02:04:57 UTC (rev 5089)
@@ -3,6 +3,7 @@
 use Test::More;
 use LedgerSMB::Database;
 use LedgerSMB;
+use LedgerSMB::Sysconfig;
 use LedgerSMB::DBObject::Admin;
 use strict;
 use DBI;
@@ -15,6 +16,9 @@
 
 my $temp = $ENV{TEMP} || '/tmp/';
 my $run_tests = 1;
+for my $log (qw(dblog dblog_stderr dblog_stdout)){
+    unlink "$LedgerSMB::Sysconfig::tempdir/$log";
+}
 for my $evar (qw(LSMB_NEW_DB LSMB_TEST_DB PG_CONTRIB_DIR)){
   if (!defined $ENV{$evar}){
       $run_tests = 0;
@@ -23,7 +27,7 @@
 }
 
 if ($run_tests){
-	plan tests => 10;
+	plan tests => 11;
 	$ENV{PGDATABASE} = $ENV{LSMB_NEW_DB};
 }
 
@@ -40,7 +44,7 @@
 
 # Manual tests
 my $rc = $db->create;
-ok(!$rc, 'Database Created') 
+ok($rc, 'Database Created') 
   || BAIL_OUT('Database could not be created! ' . $rc);
 
 ok($db->load_modules('LOADORDER'), 'Modules loaded');
@@ -50,7 +54,7 @@
     close (DBLOCK);
 }
 
-is($db->process_roles('Roles.sql'), 0, 'Roles processed');
+is($db->process_roles('Roles.sql'), 2, 'Roles processed');
 
 #Changed the COA and GIFI loading to use this, and move admin user to 
 #Database.pm --CT
@@ -91,6 +95,16 @@
       $dbh->commit;
 };
 
+open  my $log, "< $LedgerSMB::Sysconfig::tempdir/dblog";
+
+my $passed_no_errs = 1;
+while (my $line = <$log>){
+    last if $line =~ /Fixes/i; # Fixes roll back!
+    $passed_no_errs = 0 if $line =~ /Rollback/i;
+}
+
+is($passed_no_errs, 1, 'No rollbacks in db scripts');
+
 SKIP: {
      skip 'No COA specified', 1 if !defined $ENV{LSMB_LOAD_COA};
      is($db->exec_script({script => 'sql/coa/' 

Added: branches/1.3/tools/pre-release-tests.sh
===================================================================
--- branches/1.3/tools/pre-release-tests.sh	                        (rev 0)
+++ branches/1.3/tools/pre-release-tests.sh	2012-08-04 02:04:57 UTC (rev 5089)
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+sh tools/delete-company-database.sh lsmb13installtest
+
+rm -f /tmp/ledgersmb/dblog*
+
+PGUSER=postgres PGPASSWORD=test LSMB_TEST_DB=1 LSMB_NEW_DB=lsmb13installtest make test

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.