~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_http.py

  • Committer: Andrew Bennetts
  • Date: 2008-10-01 05:40:45 UTC
  • mfrom: (3753 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3756.
  • Revision ID: andrew.bennetts@canonical.com-20081001054045-z50qc0d3p9qsc5im
Merge from bzr.dev; resolve osutils.py conflict by reverting my sha import hackery.

Show diffs side-by-side

added added

removed removed

Lines of Context:
449
449
            '"GET /foo/bar HTTP/1.1" 200 - "-" "bzr/%s'
450
450
            % bzrlib.__version__) > -1)
451
451
 
452
 
    def test_get_smart_medium(self):
453
 
        # For HTTP, get_smart_medium should return the transport object.
454
 
        server = self.get_readonly_server()
455
 
        http_transport = self._transport(server.get_url())
456
 
        medium = http_transport.get_smart_medium()
457
 
        self.assertIs(medium, http_transport)
458
 
 
459
452
    def test_has_on_bogus_host(self):
460
453
        # Get a free address and don't 'accept' on it, so that we
461
454
        # can be sure there is no http handler there, but set a
1145
1138
        url = self.server.get_url()
1146
1139
        t = self._transport(url)
1147
1140
        try:
1148
 
            self.assertEqual(t.get('foo').read(), 'proxied contents of foo\n')
 
1141
            self.assertEqual('proxied contents of foo\n', t.get('foo').read())
1149
1142
        finally:
1150
1143
            self._restore_env()
1151
1144
 
1154
1147
        url = self.server.get_url()
1155
1148
        t = self._transport(url)
1156
1149
        try:
1157
 
            self.assertEqual(t.get('foo').read(), 'contents of foo\n')
 
1150
            self.assertEqual('contents of foo\n', t.get('foo').read())
1158
1151
        finally:
1159
1152
            self._restore_env()
1160
1153
 
1747
1740
        # No need to build a valid smart request here, the server will not even
1748
1741
        # try to interpret it.
1749
1742
        self.assertRaises(errors.SmartProtocolError,
1750
 
                          t.send_http_smart_request, 'whatever')
 
1743
                          t.get_smart_medium().send_http_smart_request,
 
1744
                          'whatever')
1751
1745