/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_http.py

  • Committer: John Arbash Meinel
  • Date: 2006-09-12 15:28:02 UTC
  • mto: This revision was merged to the branch mainline in revision 2001.
  • Revision ID: john@arbash-meinel.com-20060912152802-64ced185121942af
Update the urllib.has test.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
# TODO: Should be renamed to bzrlib.transport.http.tests?
21
21
 
 
22
import socket
 
23
 
22
24
import bzrlib
23
25
from bzrlib.errors import DependencyNotPresent
24
26
from bzrlib.tests import TestCase, TestSkipped
135
137
        TestCaseWithWebserver.setUp(self)
136
138
        self._prep_tree()
137
139
 
138
 
    def test_bogus_host(self):
139
 
        from urllib2 import URLError
140
 
        t = self._transport('http://1.2.3.4.5.6.7.8/')
141
 
        self.assertRaises(URLError,
142
 
            t.has,
143
 
            'foo/bar')
 
140
    def test_has_on_bogus_host(self):
 
141
        import urllib2
 
142
        # Get a random address, so that we can be sure there is no
 
143
        # http handler there.
 
144
        s = socket.socket()
 
145
        s.bind(('localhost', 0))
 
146
        t = self._transport('http://%s:%s/' % s.getsockname())
 
147
        self.assertRaises(urllib2.URLError, t.has, 'foo/bar')
144
148
 
145
149
 
146
150
class TestHttpConnections_pycurl(TestCaseWithWebserver, TestHttpMixins):