| 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(miniserver.ThisDirHandler) |
| 12 |
|
| 13 |
def tearDown(self): |
| 14 |
self.httpd.shutdown() |
| 15 |
|
| 16 |
def testGetFile(self): |
| 17 |
client = httplib2.Http() |
| 18 |
src = "miniserver.py" |
| 19 |
response, body = client.request("http://localhost:%d/%s" % (self.port, src)) |
| 20 |
self.assertEqual(response.status, 200) |
| 21 |
self.assertEqual(body, open(os.path.join(miniserver.HERE, src)).read()) |