Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@sugarlabs.org>2014-05-06 15:45:23 (GMT)
committer Aleksey Lim <alsroot@sugarlabs.org>2014-05-06 15:45:23 (GMT)
commit5ebeca1a965aa4028fde7a73c7baffbdba705ef5 (patch)
tree6f235294538de709cce4809bc2bbfbff4c396b3c /tests
parent0684b55b5f66da1c2dc61f15105ef5e0632019bf (diff)
Support HTTP connection via UNIX domain sockets
Diffstat (limited to 'tests')
-rwxr-xr-xtests/units/toolkit/http.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/units/toolkit/http.py b/tests/units/toolkit/http.py
index f05da0d..14f280b 100755
--- a/tests/units/toolkit/http.py
+++ b/tests/units/toolkit/http.py
@@ -257,6 +257,32 @@ class HTTPTest(tests.Test):
], challenges)
del challenges[:]
+ def test_UnixSocket(self):
+
+ def app(environ, start_response):
+ start_response('200', [('content-type', 'application/json')])
+ yield json.dumps([
+ environ['HTTP_HOST'],
+ environ['REQUEST_METHOD'],
+ environ['PATH_INFO'],
+ environ['QUERY_STRING'],
+ json.loads(environ['wsgi.input'].read()),
+ ])
+
+ server = coroutine.WSGIServer(coroutine.listen_unix_socket('./socket'), app)
+ coroutine.spawn(server.serve_forever)
+ coroutine.dispatch()
+
+ conn = http.Connection('file://socket')
+ self.assertEqual([
+ 'localhost',
+ 'POST',
+ '/path/subpath',
+ 'foo=bar',
+ 'payload',
+ ],
+ conn.post(['path', 'subpath'], 'payload', foo='bar'))
+
if __name__ == '__main__':
tests.main()