← Back to team overview

openerp-community team mailing list archive

[Merge] lp:~r-launchpad-njw-me-uk/openerp-xml-rpc-scripts/pluscgi into lp:openerp-xml-rpc-scripts

 

Nick White has proposed merging lp:~r-launchpad-njw-me-uk/openerp-xml-rpc-scripts/pluscgi into lp:openerp-xml-rpc-scripts.

Requested reviews:
  OpenERP Community (openerp-community)

For more details, see:
https://code.launchpad.net/~r-launchpad-njw-me-uk/openerp-xml-rpc-scripts/pluscgi/+merge/73341

Adds a cgi shell script providing a web interface to the basic tests. We use this so our qa can quickly check key functionality from a browser.
-- 
https://code.launchpad.net/~r-launchpad-njw-me-uk/openerp-xml-rpc-scripts/pluscgi/+merge/73341
Your team OpenERP Community is requested to review the proposed merge of lp:~r-launchpad-njw-me-uk/openerp-xml-rpc-scripts/pluscgi into lp:openerp-xml-rpc-scripts.
=== modified file 'basic_tests/oesettings'
--- basic_tests/oesettings	2011-08-23 14:21:17 +0000
+++ basic_tests/oesettings	2011-08-30 09:03:50 +0000
@@ -3,3 +3,4 @@
 dbname=mydb
 oeuser=admin
 oepass=password
+testdir=./

=== added file 'basic_tests/oetests.cgi.sh'
--- basic_tests/oetests.cgi.sh	1970-01-01 00:00:00 +0000
+++ basic_tests/oetests.cgi.sh	2011-08-30 09:03:50 +0000
@@ -0,0 +1,61 @@
+#!/bin/sh
+# See COPYING file in this directory for copyright and license details.
+#
+# Presents a basic web interface to the basic tests.
+#
+# The security of this script is not as bad as it looks at first,
+# but is still far from guaranteed.
+#
+# All scripts which want to be run have to be executable.
+
+# this sets host, dbname, oeuser, oepass, and testdir variables
+. ./oesettings
+
+tests='
+       runalltests.sh
+       newpurchaseorder.py
+       receivepacking.py
+       newsaleorder.py
+       sendpacking.py
+       newinvoice.py
+       removetestthings.py
+      '
+
+ret=0
+
+echo "Content-type: text/html; charset=utf-8"
+echo ""
+echo "<!DOCTYPE html><html><head><title>OpenERP Basic Tests</title></head><body>"
+
+if test -z "$QUERY_STRING"
+then
+	echo "<h2>âš™ OpenERP Basic Tests âš™</h2>"
+	echo "<ul>"
+	for i in $tests
+	do
+		echo "<li><a href="?script=$i">$i</a></li>"
+	done
+	echo "</ul>"
+else
+	script=`echo "$QUERY_STRING" | awk -F '=' '{print $2}'`
+	for test in $tests
+	do
+		if test "$script" = "$test"
+		then
+			echo "<h2>$test</h2>"
+			echo "<pre>"
+			"$testdir/$test" "$host" "$dbname" "$oeuser" "$oepass" 2>&1
+			res=$?
+			echo "</pre>"
+			if test $res -eq 0
+			then
+				echo "<h3 style=\"color: #22bb22\">✔ passed</h3>"
+			else
+				echo "<h3 style=\"color: #bb2222\">✘ failed</h3>"
+			fi
+		fi
+	done
+	echo "<p><a href=\"javascript:back()\">⎗ back to tests</a></p>"
+fi
+
+echo "</body></html>"

=== modified file 'basic_tests/runalltests.sh'
--- basic_tests/runalltests.sh	2011-08-23 15:55:34 +0000
+++ basic_tests/runalltests.sh	2011-08-30 09:03:50 +0000
@@ -21,7 +21,7 @@
 for i in $tests
 do
 	printf "%s " "$i"
-	python "$i" "$host" "$dbname" "$oeuser" "$oepass" > /dev/null 2>&1
+	python "$testdir/$i" localhost "$dbname" "$oeuser" "$oepass" > /dev/null 2>&1
 	if test $? -ne 0
 	then
 		echo "failed (run test separately for more details)"

=== modified file 'basic_tests/testconf.py'
--- basic_tests/testconf.py	2011-08-23 15:55:34 +0000
+++ basic_tests/testconf.py	2011-08-30 09:03:50 +0000
@@ -36,7 +36,7 @@
 		exit(1)
 	t['uom'] = uomids[0]
 
-	slocids = oe.search('stock.location', [('active','=','true'),('usage','=','internal'),('name','=','Stock')])
+	slocids = oe.search('stock.location', [('active','=','true'),('usage','in',['internal','view']),('name','=','Stock')])
 	if not slocids:
 		print("Cannot find internal stock location; at present these scripts need it")
 		exit(1)