/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: Martin Pool
  • Date: 2009-03-03 03:01:49 UTC
  • mfrom: (4070 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4073.
  • Revision ID: mbp@sourcefrog.net-20090303030149-8p8o8hszdtqa7w8f
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
161
161
 
162
162
class RecordingServer(object):
163
163
    """A fake HTTP server.
164
 
    
 
164
 
165
165
    It records the bytes sent to it, and replies with a 200.
166
166
    """
167
167
 
216
216
        self.port = None
217
217
 
218
218
 
 
219
class TestAuthHeader(tests.TestCase):
 
220
 
 
221
    def parse_header(self, header):
 
222
        ah =  _urllib2_wrappers.AbstractAuthHandler()
 
223
        return ah._parse_auth_header(header)
 
224
 
 
225
    def test_empty_header(self):
 
226
        scheme, remainder = self.parse_header('')
 
227
        self.assertEquals('', scheme)
 
228
        self.assertIs(None, remainder)
 
229
 
 
230
    def test_negotiate_header(self):
 
231
        scheme, remainder = self.parse_header('Negotiate')
 
232
        self.assertEquals('negotiate', scheme)
 
233
        self.assertIs(None, remainder)
 
234
 
 
235
    def test_basic_header(self):
 
236
        scheme, remainder = self.parse_header(
 
237
            'Basic realm="Thou should not pass"')
 
238
        self.assertEquals('basic', scheme)
 
239
        self.assertEquals('realm="Thou should not pass"', remainder)
 
240
 
 
241
    def test_digest_header(self):
 
242
        scheme, remainder = self.parse_header(
 
243
            'Digest realm="Thou should not pass"')
 
244
        self.assertEquals('digest', scheme)
 
245
        self.assertEquals('realm="Thou should not pass"', remainder)
 
246
 
 
247
 
219
248
class TestHTTPServer(tests.TestCase):
220
249
    """Test the HTTP servers implementations."""
221
250
 
800
829
        # bytes on the socket
801
830
        ireadv = iter(t.readv('a', ((0, 1), (1, 1), (2, 4), (6, 4))))
802
831
        self.assertEqual((0, '0'), ireadv.next())
803
 
        # The server should have issued one request so far 
 
832
        # The server should have issued one request so far
804
833
        self.assertEqual(1, server.GET_request_nb)
805
834
        self.assertEqual('0123456789', t.get_bytes('a'))
806
835
        # get_bytes issued an additional request, the readv pending ones are