Added:
/test/oildrum/lib/gaeo/app_test.py
Deleted:
/oildrum/lib/gaeo/app_test.py
=======================================
--- /dev/null
+++ /test/oildrum/lib/gaeo/app_test.py Sat Dec 4 17:56:06 2010
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""The unit test of app.py.
+
+To run the unit tests, """
+
+# Python stdlib imports
+import os
+import StringIO
+import sys
+import unittest2
+import urllib
+
+# Add App Engine paths
+import gaeo_path_util
+gaeo_path_util.add_appengine_module_paths()
+gaeo_path_util.add_gaeo_module_paths()
+
+# Import the module to be tested.
+import app
+
+class TestGaeoRequest(unittest2.TestCase):
+
+ def setUp(self):
+ # Construct the POST parameters.
+ self.post_param = (('hello', 'world'), ('hello', 'kitty'),
+ ('starbucks', 'coffee'), ('KFC', 'chicken'))
+ http_body = StringIO.StringIO()
+ post_data = urllib.urlencode(self.post_param)
+ http_body.write(post_data)
+ http_body.seek(0)
+ self.backup_stdin = sys.stdin
+ sys.stdin = http_body
+ # Construct the GET parameters.
+ self.get_param = (('iron man', '2'), ('harry potter', '7'),
+ ('harry potter', '8'))
+ environ = {'REQUEST_METHOD': 'POST',
+ 'CONTENT_TYPE': 'application/x-www-form-urlencoded',
+ 'QUERY_STRING': urllib.urlencode(self.get_param),
+ 'CONTENT_LENGTH': len(post_data),
+ }
+ app.make_wsgi_environment(environ)
+ # Make the request object.
+ self.request = app.GaeoRequest(environ)
+
+ def tearDown(self):
+ sys.stdin = self.backup_stdin
+
+ def test_get_all(self):
+ self.assertEqual(['2'], self.request.get_all('iron man'))
+ self.assertEqual(['world', 'kitty'], self.request.get_all('hello'))
+ self.assertEqual(['7', '8'], self.request.get_all('harry potter'))
+ self.assertEqual([], self.request.get_all('superman'))
+
+ def test_arguments(self):
+ self.assertEqual(
+ set(['hello', 'starbucks', 'KFC', 'iron man', 'harry potter']),
+ set(self.request.arguments()))
+
+
+if __name__ == '__main__':
+ unittest2.main()
=======================================
--- /oildrum/lib/gaeo/app_test.py Sat Nov 27 08:25:30 2010
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-"""The unit test of app.py.
-
-To run the unit tests, """
-
-# Python stdlib imports
-import os
-import StringIO
-import sys
-import unittest2
-import urllib
-
-# Add App Engine paths
-import gaeo_path_util
-gaeo_path_util.add_appengine_module_paths()
-gaeo_path_util.add_gaeo_module_paths()
-
-# Import the module to be tested.
-import app
-
-class TestGaeoRequest(unittest2.TestCase):
-
- def setUp(self):
- # Construct the POST parameters.
- self.post_param = (('hello', 'world'), ('hello', 'kitty'),
- ('starbucks', 'coffee'), ('KFC', 'chicken'))
- http_body = StringIO.StringIO()
- post_data = urllib.urlencode(self.post_param)
- http_body.write(post_data)
- http_body.seek(0)
- self.backup_stdin = sys.stdin
- sys.stdin = http_body
- # Construct the GET parameters.
- self.get_param = (('iron man', '2'), ('harry potter', '7'),
- ('harry potter', '8'))
- environ = {'REQUEST_METHOD': 'POST',
- 'CONTENT_TYPE': 'application/x-www-form-urlencoded',
- 'QUERY_STRING': urllib.urlencode(self.get_param),
- 'CONTENT_LENGTH': len(post_data),
- }
- app.make_wsgi_environment(environ)
- # Make the request object.
- self.request = app.GaeoRequest(environ)
-
- def tearDown(self):
- sys.stdin = self.backup_stdin
-
- def test_get_all(self):
- self.assertEqual(['2'], self.request.get_all('iron man'))
- self.assertEqual(['world', 'kitty'], self.request.get_all('hello'))
- self.assertEqual(['7', '8'], self.request.get_all('harry potter'))
- self.assertEqual([], self.request.get_all('superman'))
-
- def test_arguments(self):
- self.assertEqual(
- set(['hello', 'starbucks', 'KFC', 'iron man', 'harry potter']),
- set(self.request.arguments()))
-
-
-if __name__ == '__main__':
- unittest2.main()