~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_http.py

Merge bzr.dev

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
68
70
        self.assertRaises(ValueError,
69
71
            t.abspath,
70
72
            '.bzr/')
71
 
        self.assertRaises(ValueError,
72
 
            t.abspath,
73
 
            '/.bzr')
74
73
 
75
74
    def test_http_root_urls(self):
76
75
        """Construction of URLs from server root"""
135
134
        TestCaseWithWebserver.setUp(self)
136
135
        self._prep_tree()
137
136
 
 
137
    def test_has_on_bogus_host(self):
 
138
        import urllib2
 
139
        # Get a random address, so that we can be sure there is no
 
140
        # http handler there.
 
141
        s = socket.socket()
 
142
        s.bind(('localhost', 0))
 
143
        t = self._transport('http://%s:%s/' % s.getsockname())
 
144
        self.assertRaises(urllib2.URLError, t.has, 'foo/bar')
138
145
 
139
146
 
140
147
class TestHttpConnections_pycurl(TestCaseWithWebserver, TestHttpMixins):