~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_http.py

  • Committer: Tarmac
  • Author(s): Vincent Ladeuil, Patch Queue Manager, Jelmer Vernooij
  • Date: 2017-01-17 16:20:41 UTC
  • mfrom: (6619.1.2 trunk)
  • Revision ID: tarmac-20170117162041-oo62uk1qsmgc9j31
Merge 2.7 into trunk including fixes for bugs #1622039, #1644003, #1579093 and #1645017. [r=vila]

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2012, 2015, 2016 Canonical Ltd
 
1
# Copyright (C) 2005-2012, 2015, 2016, 2017 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
260
260
        self.assertEqual('basic', scheme)
261
261
        self.assertEqual('realm="Thou should not pass"', remainder)
262
262
 
 
263
    def test_build_basic_header_with_long_creds(self):
 
264
        handler = _urllib2_wrappers.BasicAuthHandler()
 
265
        user = 'user' * 10  # length 40
 
266
        password = 'password' * 5  # length 40
 
267
        header = handler.build_auth_header(
 
268
            dict(user=user, password=password), None)
 
269
        # https://bugs.launchpad.net/bzr/+bug/1606203 was caused by incorrectly
 
270
        # creating a header value with an embedded '\n'
 
271
        self.assertFalse('\n' in header)
 
272
 
263
273
    def test_basic_extract_realm(self):
264
274
        scheme, remainder = self.parse_header(
265
275
            'Basic realm="Thou should not pass"',
1273
1283
            self.no_proxy_host = self.server_host_port
1274
1284
        # The secondary server is the proxy
1275
1285
        self.proxy_url = self.get_secondary_url()
 
1286
        if self._testing_pycurl():
 
1287
            self.proxy_url = self.proxy_url.replace('+pycurl', '')
1276
1288
 
1277
1289
    def _testing_pycurl(self):
1278
1290
        # TODO: This is duplicated for lots of the classes in this file
1853
1865
                                  ])
1854
1866
 
1855
1867
    def get_user_transport(self, user, password):
1856
 
        self.overrideEnv('all_proxy', self.get_user_url(user, password))
 
1868
        proxy_url = self.get_user_url(user, password)
 
1869
        if self._testing_pycurl():
 
1870
            proxy_url = proxy_url.replace('+pycurl', '')
 
1871
        self.overrideEnv('all_proxy', proxy_url)
1857
1872
        return TestAuth.get_user_transport(self, user, password)
1858
1873
 
1859
1874
    def test_empty_pass(self):