gvsig-scripting / org.gvsig.scripting / trunk / org.gvsig.scripting / org.gvsig.scripting.app / org.gvsig.scripting.app.mainplugin / src / main / resources-plugin / scripting / lib / httplib2 / test / smoke_test.py @ 564
History | View | Annotate | Download (638 Bytes)
1 |
import os |
---|---|
2 |
import unittest |
3 |
|
4 |
import httplib2 |
5 |
|
6 |
from httplib2.test import miniserver |
7 |
|
8 |
|
9 |
class HttpSmokeTest(unittest.TestCase): |
10 |
def setUp(self): |
11 |
self.httpd, self.port = miniserver.start_server( |
12 |
miniserver.ThisDirHandler) |
13 |
|
14 |
def tearDown(self): |
15 |
self.httpd.shutdown()
|
16 |
|
17 |
def testGetFile(self): |
18 |
client = httplib2.Http() |
19 |
src = 'miniserver.py'
|
20 |
response, body = client.request('http://localhost:%d/%s' %
|
21 |
(self.port, src))
|
22 |
self.assertEqual(response.status, 200) |
23 |
self.assertEqual(body, open(os.path.join(miniserver.HERE, src)).read()) |