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

SF.net SVN: ledger-smb:[2927] trunk



Revision: 2927
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2927&view=rev
Author:   einhverfr
Date:     2010-03-01 01:35:56 +0000 (Mon, 01 Mar 2010)

Log Message:
-----------
Improvements in db setup/testing

Modified Paths:
--------------
    trunk/install-mycompany.sh
    trunk/t/01-load.t
    trunk/t/40-dbsetup.t

Modified: trunk/install-mycompany.sh
===================================================================
--- trunk/install-mycompany.sh	2010-03-01 01:15:14 UTC (rev 2926)
+++ trunk/install-mycompany.sh	2010-03-01 01:35:56 UTC (rev 2927)
@@ -5,15 +5,44 @@
 MYCOMPANY='cmd'
 MYUSER='lacey_cmd'
 PGVERSION=8.4
-
+MYUSER_FIRSTNAME='Sample'
+MYUSER_LASTNAME='User'
+MYUSER_COUNTRYCODE='US'
+MYUSER_PASSWORD='gfewtrwiecngra'
 # The following path can vary per distribution
 # Debian/Ubuntu
 CONTRIB=/usr/share/postgresql/$PGVERSION/contrib/
 # Compiled from source.
 #CONTRIB=/usr/local/pgsql/share/contrib
 
-echo "This script will create a $MYCOMPANY dataset per INSTALL. Ctrl-C to cancel."
 
+echo \
+"This script will create a $MYCOMPANY dataset per INSTALL. Ctrl-C to cancel
+within 5 sec."
+
+sleep 5;
+
+export LSMB_USERNAME=$MYUSER
+export PG_CONTRIB_DIR=$CONTRIB
+export LSMB_NEW_DB=$MYCOMPANY
+export LSMB_INSTALL_DB=1
+export LSMB_TEST_DB=1
+export LSMB_PASSWORD=$MYUSER_PASSWORD
+export LSMB_LOAD_COA=General
+
+if test ! -f Makefile
+then 
+    perl Makefile.PL
+fi
+
+# Build and test the db.
+make test
+
+
+
+# ending here.  Preserving old code for now.
+
+exit
 dropdb -i -U postgres $MYCOMPANY 
 for role in `psql -U postgres -t -c "SELECT rolname FROM pg_roles WHERE rolname LIKE 'lsmb_${MYCOMPANY}%';"`; do dropuser -U postgres $role; done
 dropuser -U postgres $MYUSER 

Modified: trunk/t/01-load.t
===================================================================
--- trunk/t/01-load.t	2010-03-01 01:15:14 UTC (rev 2926)
+++ trunk/t/01-load.t	2010-03-01 01:35:56 UTC (rev 2927)
@@ -35,7 +35,11 @@
 use_ok('LedgerSMB::Template::CSV');
 use_ok('LedgerSMB::Template::HTML');
 use_ok('LedgerSMB::Template::LaTeX');
-use_ok('LedgerSMB::Template::TXT');
+SKIP: {
+    eval{ require Template::Plugin::Latex};
+    skip 'Template::Plugin::Latex not installed', 1 if @_;
+    use_ok('LedgerSMB::Template::TXT');
+}
 use_ok('LedgerSMB::User');
 
 SKIP: {

Modified: trunk/t/40-dbsetup.t
===================================================================
--- trunk/t/40-dbsetup.t	2010-03-01 01:15:14 UTC (rev 2926)
+++ trunk/t/40-dbsetup.t	2010-03-01 01:35:56 UTC (rev 2927)
@@ -126,7 +126,7 @@
                        )");
       ok($sth->execute($ENV{LSMB_ADMIN_FNAME}, 
               $ENV{LSMB_ADMIN_LNAME}, 
-              $ENV{LSMB_COUNTRY_CODE},
+              uc($ENV{LSMB_COUNTRY_CODE}),
               $ENV{LSMB_USERNAME},
               $ENV{LSMB_PASSWORD}), 'Admin user creation query ran');
       my ($var) = $sth->fetchrow_array();
@@ -138,3 +138,38 @@
             'Admin user assigned rights');
       $sth->finish;
 };
+
+SKIP {
+     skip 'No COA specified', 2 if !defined $ENV{LSMB_LOAD_COA};
+     ok(open (PSQL, '-|', "psql -f sql/coa/".lc($ENV{LSMB_COUNTRY_CODE})
+                                ."/chart/$ENV{LSMB_LOAD_COA}.sql"), 
+        'Ran Chart of Accounts Script');
+     my $return = 1;
+     for my $line (<PSQL>){
+         chomp $line;
+         if ($line eq 'COMMIT'){
+             $return = 1;
+         } elsif ($line eq 'ROLLBACK'){
+             $return = 0;
+         }
+     } 
+     ok($return, 'Chart file committed');
+}
+
+SKIP {
+     skip 'No GIFI specified', 2 if !defined $ENV{LSMB_LOAD_GIFI};
+     ok(open (PSQL, '-|', "psql -f sql/coa/".lc($ENV{LSMB_COUNTRY_CODE})
+                                ."/gifi/$ENV{LSMB_LOAD_GIFI}.sql"), 
+        'Ran GIFI Script');
+     my $return = 1;
+     for my $line (<PSQL>){
+         chomp $line;
+         if ($line eq 'COMMIT'){
+             $return = 1;
+         } elsif ($line eq 'ROLLBACK'){
+             $return = 0;
+         }
+     } 
+     ok($return, 'GIFI file committed');
+}
+


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