~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_http.py

  • Committer: Vincent Ladeuil
  • Date: 2007-12-19 07:46:29 UTC
  • mto: (3146.3.1 179368) (3156.2.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 3158.
  • Revision ID: v.ladeuil+lp@free.fr-20071219074629-nu5z8y56lp9o3m7f
Begin refactoring test_http.py into parameterized tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
226
226
                          f.credentials[0])
227
227
 
228
228
 
229
 
class TestHttpTransportUrls(object):
230
 
    """Test the http urls.
231
 
 
232
 
    This MUST be used by daughter classes that also inherit from
233
 
    TestCase.
234
 
 
235
 
    We can't inherit directly from TestCase or the
236
 
    test framework will try to create an instance which cannot
237
 
    run, its implementation being incomplete.
238
 
    """
239
 
 
240
 
    def test_abs_url(self):
241
 
        """Construction of absolute http URLs"""
242
 
        t = self._transport('http://bazaar-vcs.org/bzr/bzr.dev/')
243
 
        eq = self.assertEqualDiff
244
 
        eq(t.abspath('.'), 'http://bazaar-vcs.org/bzr/bzr.dev')
245
 
        eq(t.abspath('foo/bar'), 'http://bazaar-vcs.org/bzr/bzr.dev/foo/bar')
246
 
        eq(t.abspath('.bzr'), 'http://bazaar-vcs.org/bzr/bzr.dev/.bzr')
247
 
        eq(t.abspath('.bzr/1//2/./3'),
248
 
           'http://bazaar-vcs.org/bzr/bzr.dev/.bzr/1/2/3')
249
 
 
250
 
    def test_invalid_http_urls(self):
251
 
        """Trap invalid construction of urls"""
252
 
        t = self._transport('http://bazaar-vcs.org/bzr/bzr.dev/')
253
 
        self.assertRaises(errors.InvalidURL,
254
 
                          self._transport,
255
 
                          'http://http://bazaar-vcs.org/bzr/bzr.dev/')
256
 
 
257
 
    def test_http_root_urls(self):
258
 
        """Construction of URLs from server root"""
259
 
        t = self._transport('http://bzr.ozlabs.org/')
260
 
        eq = self.assertEqualDiff
261
 
        eq(t.abspath('.bzr/tree-version'),
262
 
           'http://bzr.ozlabs.org/.bzr/tree-version')
263
 
 
264
 
    def test_http_impl_urls(self):
265
 
        """There are servers which ask for particular clients to connect"""
266
 
        server = self._server()
267
 
        try:
268
 
            server.setUp()
269
 
            url = server.get_url()
270
 
            self.assertTrue(url.startswith('%s://' % self._qualified_prefix))
271
 
        finally:
272
 
            server.tearDown()
273
 
 
274
 
 
275
 
class TestHttpUrls_urllib(TestHttpTransportUrls, tests.TestCase):
276
 
    """Test http urls with urllib"""
277
 
 
278
 
    _transport = HttpTransport_urllib
279
 
    _server = http_server.HttpServer_urllib
280
 
    _qualified_prefix = 'http+urllib'
281
 
 
282
 
 
283
 
class TestHttpUrls_pycurl(TestWithTransport_pycurl, TestHttpTransportUrls,
284
 
                          tests.TestCase):
 
229
class TestHttpUrls_pycurl(TestWithTransport_pycurl, tests.TestCase):
285
230
    """Test http urls with pycurl"""
286
231
 
287
232
    _server = http_server.HttpServer_PyCurl