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

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



Revision: 3073
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3073&view=rev
Author:   einhverfr
Date:     2010-09-30 20:16:32 +0000 (Thu, 30 Sep 2010)

Log Message:
-----------
Lacey's test case fixes

Modified Paths:
--------------
    trunk/sql/modules/test/Payment.sql
    trunk/t/63-lwp.t

Modified: trunk/sql/modules/test/Payment.sql
===================================================================
--- trunk/sql/modules/test/Payment.sql	2010-09-28 19:49:17 UTC (rev 3072)
+++ trunk/sql/modules/test/Payment.sql	2010-09-30 20:16:32 UTC (rev 3073)
@@ -11,7 +11,7 @@
 INSERT INTO chart (accno, description, charttype, category, link)
 VALUES ('00001', 'testing', 'A', 'L', 'AP');
 INSERT INTO chart (accno, description, charttype, category, link)
-VALUES ('00002', 'testing2', 'A', 'E', 'AP_expense');
+VALUES ('00002', 'testing2', 'A', 'E', 'AP_amount');
 INSERT INTO chart (accno, description, charttype, category, link)
 VALUES ('00003', 'testing2', 'A', 'A', 'AP_paid');
 

Modified: trunk/t/63-lwp.t
===================================================================
--- trunk/t/63-lwp.t	2010-09-28 19:49:17 UTC (rev 3072)
+++ trunk/t/63-lwp.t	2010-09-30 20:16:32 UTC (rev 3073)
@@ -19,7 +19,7 @@
 $host =~ /https?:\/\/([^\/]+)\//;
 $hostname = $1;
 my $db = $ENV{LSMB_NEW_DB} || $ENV{PGDATABASE};
-do 't/data/62-request-data'; # Import test case oashes
+my @test_request_data = do { 't/data/62-request-data' };
 my $browser = LWP::UserAgent->new( );
 if ($host !~ /https?:.+:/){
 	if ($host =~ /http:/){
@@ -43,40 +43,56 @@
 $cookie->extract_cookies($response);
 $browser->cookie_jar($cookie);
 
-for my $test (@$test_request_data){
+for my $test (@test_request_data){
 	next if $test->{_skip_lwp};
 	my $argstr = "";
-        my $module = "";
+    my $module = "";
 	for $key (keys %$test){
 		# scan both key and value for _$GLOBAL$.
 		# replace _$GLOBAL$:varname with the value from the %GLOBAL{varname}
-		if ($key =~ /_\$GLOBAL\$:(.*)$/) {
+		if ( ( defined $key ) && $key =~ /_\$GLOBAL\$:(.*)$/) {
 			my $newkey = $GLOBAL{$1};
 			$test->{$newkey} = $test->{$key};
 			$key = $newkey;
 		}
-		if ($test->{$key} =~ /_\$GLOBAL\$:(.*)$/) {
+		if ( ( defined $key ) && ( defined $test->{$key} ) && ($test->{$key} =~ /_\$GLOBAL\$:(.*)$/ ) ) {
 			my $val = $GLOBAL{$1};
 			$test->{$key} = $val;
 		}
-		if ($key eq 'module'){
+		if ( ( defined $key ) && ( $key eq 'module' ) ){
 			$module = $test->{"$key"}
 		}
-		elsif ($key !~ /^\_/){
+		elsif ( ( defined $test->{"key"} ) && ( defined $key ) && ( $key !~ /^\_/ ) ){
 			$argstr .= "&" . "$key=".$test->{"$key"};
 		}
 	}
 	$argstr =~ s/^&//;
 	my $url="$host$module?$argstr&company=$db";
 	my $response = $browser->get($url);
-	ok($response->is_success(), "$test->{_test_id} RESPONSE 200")
+    my $retstr = "";
+    if ( defined $test->{_test_id} ) 
+    { 
+        $retstr = "$test->{_test_id} RESPONSE 200"  
+    } 
+    else 
+    { 
+        $retstr="\$test->{_test_id} is undefined. RESPONSE 200" 
+    }
+	ok($response->is_success(), $retstr)
 		|| print STDERR "# " .$response->status_line() . ":$url\n";
-	if ($test->{format} eq 'PDF'){
+	if ( ( defined $test->{format} ) && ($test->{format} eq 'PDF' ) ){
 		cmp_ok($response->header('content-type'), 'eq', 
 			'application/pdf', "$test->{_test_id} PDF sent");
 	} else {
-		like($response->header('content-type'), qr/^text\/html/,
-			"$test->{_test_id} HTML sent");
+        if ( defined $test->{_test_id} ) 
+        { 
+            $retstr = "$test->{_test_id} HTML sent"  
+        } 
+        else 
+        { 
+            $retstr="\$test->{_test_id} is undefined. HTML sent" 
+        }
+		like($response->header('content-type'), qr/^text\/html/, $retstr);
 	}
 	if (ref($test->{_lwp_tests}) eq 'CODE'){
 		$test->{_lwp_tests}($response);


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