You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-dev@quetz.apache.org by "Gregory (Grisha) Trubetskoy" <gr...@apache.org> on 2005/01/20 16:12:05 UTC
Re: svn commit: r125771 - /httpd/mod_python/trunk/test/htdocs/tests.py
/httpd/mod_python/trunk/test/test.py
This is very cool!
Grisha
On Thu, 20 Jan 2005 nlehuen@apache.org wrote:
> Author: nlehuen
> Date: Thu Jan 20 06:20:54 2005
> New Revision: 125771
>
> URL: http://svn.apache.org/viewcvs?view=rev&rev=125771
> Log:
> Added two unit tests for the PythonOption directive. The first one test the basic behaviour of PythonOption, the second checks that you can override a PythonOption with a local value.
> Modified:
> httpd/mod_python/trunk/test/htdocs/tests.py
> httpd/mod_python/trunk/test/test.py
>
> Modified: httpd/mod_python/trunk/test/htdocs/tests.py
> Url: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/test/htdocs/tests.py?view=diff&rev=125771&p1=httpd/mod_python/trunk/test/htdocs/tests.py&r1=125770&p2=httpd/mod_python/trunk/test/htdocs/tests.py&r2=125771
> ==============================================================================
> --- httpd/mod_python/trunk/test/htdocs/tests.py (original)
> +++ httpd/mod_python/trunk/test/htdocs/tests.py Thu Jan 20 06:20:54 2005
> @@ -814,6 +814,9 @@
>
> return apache.OK
>
> +def PythonOption_items(req):
> + req.write(str(req.get_options().items()))
> + return apache.OK
>
> def _test_table():
>
>
> Modified: httpd/mod_python/trunk/test/test.py
> Url: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/test/test.py?view=diff&rev=125771&p1=httpd/mod_python/trunk/test/test.py&r1=125770&p2=httpd/mod_python/trunk/test/test.py&r2=125771
> ==============================================================================
> --- httpd/mod_python/trunk/test/test.py (original)
> +++ httpd/mod_python/trunk/test/test.py Thu Jan 20 06:20:54 2005
> @@ -221,11 +221,12 @@
> LogLevel("debug"),
> LogFormat(r'"%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined'),
> CustomLog("logs/access_log combined"),
> - LockFile("logs/accept.lock"),
> + # LockFile("logs/accept.lock"),
> TypesConfig("conf/mime.types"),
> PidFile("logs/httpd.pid"),
> ServerName("127.0.0.1"),
> Listen(PORT),
> + PythonOption('PythonOptionTest sample_value'),
> DocumentRoot(DOCUMENT_ROOT),
> LoadModule("python_module %s" % MOD_PYTHON_SO),
> IfModule("!mod_auth.c",
> @@ -623,6 +624,49 @@
> if (rsp != "test ok"):
> self.fail(`rsp`)
>
> + def test_PythonOption_conf(self):
> +
> + c = VirtualHost("*",
> + ServerName("test_PythonOption"),
> + DocumentRoot(DOCUMENT_ROOT),
> + Directory(DOCUMENT_ROOT,
> + SetHandler("mod_python"),
> + PythonHandler("tests::PythonOption_items"),
> + PythonDebug("On")))
> +
> + return str(c)
> +
> + def test_PythonOption(self):
> +
> + print "\n * Testing PythonOption"
> +
> + rsp = self.vhost_get("test_PythonOption")
> +
> + if (rsp != "[('PythonOptionTest', 'sample_value')]"):
> + self.fail(`rsp`)
> +
> + def test_PythonOption_override_conf(self):
> +
> + c = VirtualHost("*",
> + ServerName("test_PythonOption_override"),
> + DocumentRoot(DOCUMENT_ROOT),
> + Directory(DOCUMENT_ROOT,
> + SetHandler("mod_python"),
> + PythonHandler("tests::PythonOption_items"),
> + PythonOption('PythonOptionTest "new_value"'),
> + PythonDebug("On")))
> +
> + return str(c)
> +
> + def test_PythonOption_override(self):
> +
> + print "\n * Testing PythonOption override"
> +
> + rsp = self.vhost_get("test_PythonOption_override")
> +
> + if (rsp != "[('PythonOptionTest', 'new_value')]"):
> + self.fail(`rsp`)
> +
> def test_util_fieldstorage_conf(self):
>
> c = VirtualHost("*",
> @@ -1023,6 +1067,8 @@
> perRequestSuite.addTest(PerRequestTestCase("test_req_register_cleanup"))
> perRequestSuite.addTest(PerRequestTestCase("test_req_headers_out"))
> perRequestSuite.addTest(PerRequestTestCase("test_req_sendfile"))
> + perRequestSuite.addTest(PerRequestTestCase("test_PythonOption"))
> + perRequestSuite.addTest(PerRequestTestCase("test_PythonOption_override"))
> perRequestSuite.addTest(PerRequestTestCase("test_util_fieldstorage"))
> perRequestSuite.addTest(PerRequestTestCase("test_postreadrequest"))
> perRequestSuite.addTest(PerRequestTestCase("test_trans"))
>