[Osaas-commits] r69 - in trunk: . server/test
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Mar 19 19:08:01 CET 2010
Author: bh
Date: 2010-03-19 19:08:01 +0100 (Fri, 19 Mar 2010)
New Revision: 69
Modified:
trunk/ChangeLog
trunk/server/test/test_formparser.py
trunk/server/test/test_osasserver.py
Log:
Adapt server tests to new timestamps:
* server/test/test_formparser.py
(FormParsingTests::test_convert_form_urlencoded)
(FormParsingTests::test_missing_required_parameters_in_formdata)
(FormParsingTests::test_missing_required_parameters_in_requeststring)
(FormParsingTests::test_missing_optional_parameters)
(FormParsingTests::test_duplicate_parameters)
(FormParsingTests::test_duplicate_parameters_in_requeststring):
Adapt to new form fields starttime and endtime and add
milliseconds to timestamps.
* server/test/test_osasserver.py
(OSAASDBServerTests::test_post_with_content)
(OSAASDBServerTests::test_post_with_content_and_filtering)
(OSAASDBServerTests::test_post_without_service_field)
(OSAASDBServerTests::test_post_with_content_with_missing_fields):
Adapt to new form fields starttime and endtime and add
milliseconds to timestamps.
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2010-03-19 18:04:57 UTC (rev 68)
+++ trunk/ChangeLog 2010-03-19 18:08:01 UTC (rev 69)
@@ -1,5 +1,27 @@
2010-03-19 Bernhard Herzog <bh at intevation.de>
+ Adapt server tests to new timestamps:
+
+ * server/test/test_formparser.py
+ (FormParsingTests::test_convert_form_urlencoded)
+ (FormParsingTests::test_missing_required_parameters_in_formdata)
+ (FormParsingTests::test_missing_required_parameters_in_requeststring)
+ (FormParsingTests::test_missing_optional_parameters)
+ (FormParsingTests::test_duplicate_parameters)
+ (FormParsingTests::test_duplicate_parameters_in_requeststring):
+ Adapt to new form fields starttime and endtime and add
+ milliseconds to timestamps.
+
+ * server/test/test_osasserver.py
+ (OSAASDBServerTests::test_post_with_content)
+ (OSAASDBServerTests::test_post_with_content_and_filtering)
+ (OSAASDBServerTests::test_post_without_service_field)
+ (OSAASDBServerTests::test_post_with_content_with_missing_fields):
+ Adapt to new form fields starttime and endtime and add
+ milliseconds to timestamps.
+
+2010-03-19 Bernhard Herzog <bh at intevation.de>
+
* server/osaas/formparser.py: Replace the single timestamp
responsetime with two timestamps: starttime and endtime. This
allows OSAAS to log the duration of requests.
Modified: trunk/server/test/test_formparser.py
===================================================================
--- trunk/server/test/test_formparser.py 2010-03-19 18:04:57 UTC (rev 68)
+++ trunk/server/test/test_formparser.py 2010-03-19 18:08:01 UTC (rev 69)
@@ -1,4 +1,4 @@
-# Copyright (C) 2007 by Intevation GmbH
+# Copyright (C) 2007, 2010 by Intevation GmbH
# Authors:
# Bernhard Herzog <bh at intevation.de>
#
@@ -23,7 +23,8 @@
# In the test data in this test case, the colons are
# percent-escaped as well, because Java does it that way.
formdata = "&".join(["user=karl",
- "responsetime=2007-06-01T12%3A14%3A16Z",
+ "starttime=2007-06-01T12%3A14%3A15.012Z",
+ "endtime=2007-06-01T12%3A14%3A16.468Z",
"wmsidextern=example.com%2Fcgi-bin%2Ffridawms",
"wmsidintern=localhost%2Fcgi-bin%2Fmyfrida",
"requeststring=VERSION=1.1.1%26REQUEST=GetMap"
@@ -35,8 +36,10 @@
"%26SERVICE=WMS"])
self.check_attributes(parse_formdata(formdata),
user="karl",
- responsetime=datetime.datetime(2007, 6, 1,
- 12, 14, 16),
+ starttime=datetime.datetime(2007, 6, 1,
+ 12, 14, 15, 12000),
+ endtime=datetime.datetime(2007, 6, 1,
+ 12, 14, 16, 468000),
wmsidextern="example.com/cgi-bin/fridawms",
wmsidintern="localhost/cgi-bin/myfrida",
requeststring=("VERSION=1.1.1&REQUEST=GetMap"
@@ -79,7 +82,7 @@
def test_missing_required_parameters_in_formdata(self):
# formdata is missing the required field "user"
- formdata = "&".join(["responsetime=2007-06-01T12:14:16Z",
+ formdata = "&".join(["endtime=2007-06-01T12:14:16.468Z",
"wmsidextern=example.com%2Fcgi-bin%2Ffridawms",
"wmsidintern=localhost%2Fcgi-bin%2Fmyfrida",
"requeststring=VERSION=1.1.1%26REQUEST=GetMap"
@@ -96,7 +99,8 @@
def test_missing_required_parameters_in_requeststring(self):
# requeststring is missing the required field "REQUEST"
- formdata = "&".join(["user=karl", "responsetime=2007-06-01T12:14:16Z",
+ formdata = "&".join(["user=karl", "starttime=2007-06-01T12:14:14.001Z",
+ "endtime=2007-06-01T12:14:16.468Z",
"wmsidextern=example.com%2Fcgi-bin%2Ffridawms",
"wmsidintern=localhost%2Fcgi-bin%2Fmyfrida",
"requeststring=VERSION=1.1.1"
@@ -113,7 +117,7 @@
def test_missing_optional_parameters(self):
# requeststring is missing the optional field "SERVICE"
- formdata = "&".join(["user=karl", "responsetime=2007-06-01T12:14:16Z",
+ formdata = "&".join(["user=karl", "endtime=2007-06-01T12:14:16.468Z",
"wmsidextern=example.com%2Fcgi-bin%2Ffridawms",
"wmsidintern=localhost%2Fcgi-bin%2Fmyfrida",
"requeststring=VERSION=1.1.1%26REQUEST=GetMap"
@@ -125,8 +129,8 @@
record = parse_formdata(formdata)
self.check_attributes(parse_formdata(formdata),
user="karl",
- responsetime=datetime.datetime(2007, 6, 1,
- 12, 14, 16),
+ endtime=datetime.datetime(2007, 6, 1,
+ 12, 14, 16, 468000),
wmsidextern="example.com/cgi-bin/fridawms",
wmsidintern="localhost/cgi-bin/myfrida",
requeststring=("VERSION=1.1.1&REQUEST=GetMap"
@@ -153,8 +157,8 @@
SERVICE=None)
def test_duplicate_parameters(self):
- # The responsetime occurs twice
- formdata = "&".join(["user=karl", "responsetime=2007-06-01T12:14:16Z",
+ # The endtime occurs twice
+ formdata = "&".join(["user=karl", "endtime=2007-06-01T12:14:16.468Z",
"wmsidextern=example.com%2Fcgi-bin%2Ffridawms",
"wmsidintern=localhost%2Fcgi-bin%2Fmyfrida",
"requeststring=VERSION=1.1.1"
@@ -164,14 +168,14 @@
"%26BGCOLOR=0xffffff%26BBOX=0.0,0.0,460.0,348.0"
"%26LAYERS=gewaesser%26STYLES=%26SRS=EPSG:4326"
"%26SERVICE=WMS",
- "responsetime=2007-06-01T12:14:16Z"])
+ "endtime=2007-06-01T12:14:16.468Z"])
self.check_exception(FormParserException,
- "only one value allowed for field 'responsetime'",
+ "only one value allowed for field 'endtime'",
parse_formdata, formdata)
def test_duplicate_parameters_in_requeststring(self):
# The SERVICE field occurs twice in the requeststring
- formdata = "&".join(["user=karl", "responsetime=2007-06-01T12:14:16Z",
+ formdata = "&".join(["user=karl", "endtime=2007-06-01T12:14:16.468Z",
"wmsidextern=example.com%2Fcgi-bin%2Ffridawms",
"wmsidintern=localhost%2Fcgi-bin%2Fmyfrida",
"requeststring=VERSION=1.1.1%26REQUEST=GetMap"
Modified: trunk/server/test/test_osasserver.py
===================================================================
--- trunk/server/test/test_osasserver.py 2010-03-19 18:04:57 UTC (rev 68)
+++ trunk/server/test/test_osasserver.py 2010-03-19 18:08:01 UTC (rev 69)
@@ -1,4 +1,4 @@
-# Copyright (C) 2007, 2008 by Intevation GmbH
+# Copyright (C) 2007, 2008, 2010 by Intevation GmbH
# Authors:
# Bernhard Herzog <bh at intevation.de>
#
@@ -126,7 +126,9 @@
def test_post_with_content(self):
formdata = "&".join([
- "user=karl", "responsetime=2007-06-01T12:14:16Z",
+ "user=karl",
+ "starttime=2007-06-01T12:14:10.000Z",
+ "endtime=2007-06-01T12:14:16.321Z",
"wmsidextern=example.com%2Fcgi-bin%2Ffridawms",
"wmsidintern=localhost%2Fcgi-bin%2Fmyfrida",
"requeststring=VERSION=1.1.1%26REQUEST=GetMap"
@@ -141,8 +143,10 @@
self.assertEquals(len(self.dbrequests), 1)
self.check_attributes(self.dbrequests[0],
user="karl",
- responsetime=datetime.datetime(2007, 6, 1,
- 12, 14, 16),
+ starttime=datetime.datetime(2007, 6, 1,
+ 12, 14, 10, 0),
+ endtime=datetime.datetime(2007, 6, 1,
+ 12, 14, 16, 321000),
wmsidextern="example.com/cgi-bin/fridawms",
wmsidintern="localhost/cgi-bin/myfrida",
requeststring=("VERSION=1.1.1&REQUEST=GetMap"
@@ -172,13 +176,17 @@
def test_post_with_content_and_filtering(self):
self.send_formdata_request("&".join([
- "user=karl", "responsetime=2007-06-01T12:14:16Z",
+ "user=karl",
+ "starttime=2007-06-01T12:14:09.123Z",
+ "endtime=2007-06-01T12:14:16.515Z",
"wmsidextern=example.com%2Fcgi-bin%2Ffridawms",
"wmsidintern=localhost%2Fcgi-bin%2Fmyfrida",
"requeststring=VERSION=1.1.1%26REQUEST=GetCapabilities"
"%26SERVICE=WMS"]))
self.send_formdata_request("&".join([
- "user=karl", "responsetime=2007-06-01T12:14:17Z",
+ "user=karl",
+ "starttime=2007-06-01T12:14:17.832Z",
+ "endtime=2007-06-01T12:15:20.746Z",
"wmsidextern=example.com%2Fcgi-bin%2Ffridawms",
"wmsidintern=localhost%2Fcgi-bin%2Fmyfrida",
"requeststring=VERSION=1.1.1%26REQUEST=GetMap"
@@ -192,8 +200,10 @@
self.assertEquals(len(self.dbrequests), 1)
self.check_attributes(self.dbrequests[0],
user="karl",
- responsetime=datetime.datetime(2007, 6, 1,
- 12, 14, 17),
+ starttime=datetime.datetime(2007, 6, 1,
+ 12, 14, 17, 832000),
+ endtime=datetime.datetime(2007, 6, 1,
+ 12, 15, 20, 746000),
wmsidextern="example.com/cgi-bin/fridawms",
wmsidintern="localhost/cgi-bin/myfrida",
requeststring=("VERSION=1.1.1&REQUEST=GetMap"
@@ -222,12 +232,15 @@
def test_post_without_service_field(self):
self.send_formdata_request("&".join([
- "user=karl", "responsetime=2007-06-01T12:14:16Z",
+ "user=karl", "starttime=2007-06-01T12:14:16.010Z",
+ "endtime=2007-06-01T12:14:17.987Z",
"wmsidextern=example.com%2Fcgi-bin%2Ffridawms",
"wmsidintern=localhost%2Fcgi-bin%2Fmyfrida",
"requeststring=VERSION=1.1.1%26REQUEST=GetCapabilities"]))
self.send_formdata_request("&".join([
- "user=karl", "responsetime=2007-06-01T12:14:17Z",
+ "user=karl",
+ "starttime=2007-06-01T12:14:18.020Z",
+ "endtime=2007-06-01T12:14:22.000Z",
"wmsidextern=example.com%2Fcgi-bin%2Ffridawms",
"wmsidintern=localhost%2Fcgi-bin%2Fmyfrida",
"requeststring=VERSION=1.1.1%26REQUEST=GetMap"
@@ -240,8 +253,10 @@
self.assertEquals(len(self.dbrequests), 1)
self.check_attributes(self.dbrequests[0],
user="karl",
- responsetime=datetime.datetime(2007, 6, 1,
- 12, 14, 17),
+ starttime=datetime.datetime(2007, 6, 1,
+ 12, 14, 18, 20000),
+ endtime=datetime.datetime(2007, 6, 1,
+ 12, 14, 22, 0),
wmsidextern="example.com/cgi-bin/fridawms",
wmsidintern="localhost/cgi-bin/myfrida",
requeststring=("VERSION=1.1.1&REQUEST=GetMap"
@@ -267,9 +282,10 @@
SRS="EPSG:4326")
def test_post_with_content_with_missing_fields(self):
- # the formdata is missing the "responsetime" field
+ # the formdata is missing the "endtime" field
formdata = "&".join([
"user=karl",
+ "starttime=2007-06-01T12:14:18.020Z",
"wmsidextern=example.com%2Fcgi-bin%2Ffridawms",
"wmsidintern=localhost%2Fcgi-bin%2Fmyfrida",
"requeststring=VERSION=1.1.1%26REQUEST=GetMap"
@@ -281,5 +297,5 @@
"%26SERVICE=WMS"])
response_text = self.send_formdata_request(formdata,
expected_status=400)
- self.failUnless("formdata is missing required field 'responsetime'"
+ self.failUnless("formdata is missing required field 'endtime'"
in response_text)
More information about the Osaas-commits
mailing list