[Inteproxy-commits] r42 - in trunk: . test
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Apr 11 15:17:37 CEST 2007
Author: bh
Date: 2007-04-11 15:17:37 +0200 (Wed, 11 Apr 2007)
New Revision: 42
Modified:
trunk/ChangeLog
trunk/test/test_transcoder_map.py
Log:
* test/test_transcoder_map.py
(TestTranscoderMap.test_get_transcoder_http_proxy)
(TestTranscoderMap.test_get_transcoder_inteproxy_style):
New. Tests for the get_transcoder method.
(TestTranscoderMap.test, TestTranscoderMap.test_lookup): Renamed
the test method to test_lookup.
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-04-11 13:14:49 UTC (rev 41)
+++ trunk/ChangeLog 2007-04-11 13:17:37 UTC (rev 42)
@@ -1,5 +1,14 @@
2007-04-11 Bernhard Herzog <bh at intevation.de>
+ * test/test_transcoder_map.py
+ (TestTranscoderMap.test_get_transcoder_http_proxy)
+ (TestTranscoderMap.test_get_transcoder_inteproxy_style):
+ New. Tests for the get_transcoder method.
+ (TestTranscoderMap.test, TestTranscoderMap.test_lookup): Renamed
+ the test method to test_lookup.
+
+2007-04-11 Bernhard Herzog <bh at intevation.de>
+
* transcoder.py (TranscoderMap.get_transcoder, get_transcoder):
Turn the get_transcoder function into a method of TranscoderMap.
Modified: trunk/test/test_transcoder_map.py
===================================================================
--- trunk/test/test_transcoder_map.py 2007-04-11 13:14:49 UTC (rev 41)
+++ trunk/test/test_transcoder_map.py 2007-04-11 13:17:37 UTC (rev 42)
@@ -34,7 +34,8 @@
self.config_filename = self.create_temp_file(self.id(),
self.config_contents)
- def test(self):
+ def test_lookup(self):
+ """Test the lookup method"""
transcoder_map = create_transcoder_map()
transcoder_map.read_config(self.config_filename)
@@ -63,3 +64,60 @@
msg=("Wrong class for %(method)s %(host)s%(path)s:"
" got %(cls)s expected %(expectedcls)s" % locals())
self.assertEquals(cls, expectedcls, msg)
+
+ def test_get_transcoder_http_proxy(self):
+ """Test the get_transcoder method in http-proxy mode"""
+ transcoder_map = create_transcoder_map()
+ transcoder_map.read_config(self.config_filename)
+
+ test_cases = [
+ ("GET", "http://inteproxy-demo.intevation.org/cgi-bin/frida-wms",
+ OWSProxyGETTranscoder),
+ ("POST", "http://inteproxy-demo.intevation.org/cgi-bin/frida-wms",
+ OWSProxyPOSTTranscoder),
+ ("GET", "http://inteproxy-demo.intevation.org/cgi-bin/frida",
+ IdentityTranscoder),
+ ("POST", "http://inteproxy-demo.intevation.org/cgi-bin/frida",
+ IdentityTranscoder),
+
+ ("GET", "http://example.com/foo", OWSProxyGETTranscoder),
+ ("POST", "http://example.com/foo", OWSProxyPOSTTranscoder),
+
+ # Example for a non-WMS request sent by deejump
+ ("GET",
+ "http://schemas.opengeospatial.net/wms/1.1.1/WMS_MS_Capabilities.dtd",
+ IdentityTranscoder),
+ ]
+
+ for method, url, expectedcls in test_cases:
+ transcoder = transcoder_map.get_transcoder(method, url)
+ cls = transcoder.__class__
+ msg=("Wrong class for %(method)s %(url)s:"
+ " got %(cls)s expected %(expectedcls)s" % locals())
+ self.assertEquals(cls, expectedcls, msg)
+
+ def test_get_transcoder_inteproxy_style(self):
+ """Test the get_transcoder method in InteProxy mode"""
+ transcoder_map = create_transcoder_map()
+ transcoder_map.read_config(self.config_filename)
+
+ test_cases = [
+ ("GET", "/inteproxy-demo.intevation.org/cgi-bin/frida-wms",
+ OWSProxyGETTranscoder),
+ ("POST", "/inteproxy-demo.intevation.org/cgi-bin/frida-wms",
+ OWSProxyPOSTTranscoder),
+ ("GET", "/inteproxy-demo.intevation.org/cgi-bin/frida",
+ IdentityTranscoder),
+ ("POST", "/inteproxy-demo.intevation.org/cgi-bin/frida",
+ IdentityTranscoder),
+
+ ("GET", "/example.com/foo", OWSProxyGETTranscoder),
+ ("POST", "/example.com/foo", OWSProxyPOSTTranscoder),
+ ]
+
+ for method, url, expectedcls in test_cases:
+ transcoder = transcoder_map.get_transcoder(method, url)
+ cls = transcoder.__class__
+ msg=("Wrong class for %(method)s %(url)s:"
+ " got %(cls)s expected %(expectedcls)s" % locals())
+ self.assertEquals(cls, expectedcls, msg)
More information about the Inteproxy-commits
mailing list