~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_http.py

  • Committer: Jelmer Vernooij
  • Date: 2011-08-19 22:34:02 UTC
  • mto: This revision was merged to the branch mainline in revision 6089.
  • Revision ID: jelmer@samba.org-20110819223402-wjywqb0fa1xxx522
Use get_transport_from_{url,path} in more places.

Show diffs side-by-side

added added

removed removed

Lines of Context:
533
533
    scenarios = vary_by_http_client_implementation()
534
534
 
535
535
    def test_http_registered(self):
536
 
        t = transport.get_transport('%s://foo.com/' % self._url_protocol)
 
536
        t = transport.get_transport_from_url(
 
537
            '%s://foo.com/' % self._url_protocol)
537
538
        self.assertIsInstance(t, transport.Transport)
538
539
        self.assertIsInstance(t, self._transport)
539
540
 
551
552
        self.start_server(server)
552
553
        url = server.get_url()
553
554
        # FIXME: needs a cleanup -- vila 20100611
554
 
        http_transport = transport.get_transport(url)
 
555
        http_transport = transport.get_transport_from_url(url)
555
556
        code, response = http_transport._post('abc def end-of-body')
556
557
        self.assertTrue(
557
558
            server.received_bytes.startswith('POST /.bzr/smart HTTP/1.'))
1635
1636
        return url
1636
1637
 
1637
1638
    def get_user_transport(self, user, password):
1638
 
        t = transport.get_transport(self.get_user_url(user, password))
 
1639
        t = transport.get_transport_from_url(
 
1640
            self.get_user_url(user, password))
1639
1641
        return t
1640
1642
 
1641
1643
    def test_no_user(self):
1915
1917
        # The 'readv' command in the smart protocol both sends and receives
1916
1918
        # bulk data, so we use that.
1917
1919
        self.build_tree(['data-file'])
1918
 
        http_transport = transport.get_transport(self.http_server.get_url())
 
1920
        http_transport = transport.get_transport_from_url(
 
1921
            self.http_server.get_url())
1919
1922
        medium = http_transport.get_smart_medium()
1920
1923
        # Since we provide the medium, the url below will be mostly ignored
1921
1924
        # during the test, as long as the path is '/'.
1929
1932
        post_body = 'hello\n'
1930
1933
        expected_reply_body = 'ok\x012\n'
1931
1934
 
1932
 
        http_transport = transport.get_transport(self.http_server.get_url())
 
1935
        http_transport = transport.get_transport_from_url(
 
1936
            self.http_server.get_url())
1933
1937
        medium = http_transport.get_smart_medium()
1934
1938
        response = medium.send_http_smart_request(post_body)
1935
1939
        reply_body = response.read()