~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_http.py

  • Committer: Vincent Ladeuil
  • Date: 2016-02-01 18:09:18 UTC
  • mfrom: (6614.1.3 assert)
  • mto: This revision was merged to the branch mainline in revision 6615.
  • Revision ID: v.ladeuil+lp@free.fr-20160201180918-jqtq8ol6gdbbbtpv
Fix deprecated assertions to unblock release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2012, 2015 Canonical Ltd
 
1
# Copyright (C) 2005-2012, 2015, 2016 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
288
288
        self.req_handler = RequestHandler(None, None, None)
289
289
 
290
290
    def assertRanges(self, ranges, header, file_size):
291
 
        self.assertEquals(ranges,
 
291
        self.assertEqual(ranges,
292
292
                          self.req_handler._parse_ranges(header, file_size))
293
293
 
294
294
    def test_simple_range(self):
1200
1200
 
1201
1201
    def assertEvaluateProxyBypass(self, expected, host, no_proxy):
1202
1202
        handler = _urllib2_wrappers.ProxyHandler()
1203
 
        self.assertEquals(expected,
 
1203
        self.assertEqual(expected,
1204
1204
                          handler.evaluate_proxy_bypass(host, no_proxy))
1205
1205
 
1206
1206
    def test_empty_user(self):
1599
1599
            path='/',
1600
1600
            realm='Realm',
1601
1601
            ))
1602
 
        self.assertEquals((user, password), got_pass)
 
1602
        self.assertEqual((user, password), got_pass)
1603
1603
 
1604
1604
 
1605
1605
class TestAuth(http_utils.TestCaseWithWebserver):
2000
2000
        self.assertIsInstance(r, type(t))
2001
2001
        # Both transports share the some connection
2002
2002
        self.assertEqual(t._get_connection(), r._get_connection())
2003
 
        self.assertEquals('http://www.example.com/foo/subdir/', r.base)
 
2003
        self.assertEqual('http://www.example.com/foo/subdir/', r.base)
2004
2004
 
2005
2005
    def test_redirected_to_self_with_slash(self):
2006
2006
        t = self._transport('http://www.example.com/foo')
2017
2017
        r = t._redirected_to('http://www.example.com/foo',
2018
2018
                             'http://foo.example.com/foo/subdir')
2019
2019
        self.assertIsInstance(r, type(t))
2020
 
        self.assertEquals('http://foo.example.com/foo/subdir/',
 
2020
        self.assertEqual('http://foo.example.com/foo/subdir/',
2021
2021
            r.external_url())
2022
2022
 
2023
2023
    def test_redirected_to_same_host_sibling_protocol(self):
2025
2025
        r = t._redirected_to('http://www.example.com/foo',
2026
2026
                             'https://www.example.com/foo')
2027
2027
        self.assertIsInstance(r, type(t))
2028
 
        self.assertEquals('https://www.example.com/foo/',
 
2028
        self.assertEqual('https://www.example.com/foo/',
2029
2029
            r.external_url())
2030
2030
 
2031
2031
    def test_redirected_to_same_host_different_protocol(self):
2032
2032
        t = self._transport('http://www.example.com/foo')
2033
2033
        r = t._redirected_to('http://www.example.com/foo',
2034
2034
                             'ftp://www.example.com/foo')
2035
 
        self.assertNotEquals(type(r), type(t))
2036
 
        self.assertEquals('ftp://www.example.com/foo/', r.external_url())
 
2035
        self.assertNotEqual(type(r), type(t))
 
2036
        self.assertEqual('ftp://www.example.com/foo/', r.external_url())
2037
2037
 
2038
2038
    def test_redirected_to_same_host_specific_implementation(self):
2039
2039
        t = self._transport('http://www.example.com/foo')
2040
2040
        r = t._redirected_to('http://www.example.com/foo',
2041
2041
                             'https+urllib://www.example.com/foo')
2042
 
        self.assertEquals('https://www.example.com/foo/', r.external_url())
 
2042
        self.assertEqual('https://www.example.com/foo/', r.external_url())
2043
2043
 
2044
2044
    def test_redirected_to_different_host_same_user(self):
2045
2045
        t = self._transport('http://joe@www.example.com/foo')
2047
2047
                             'https://foo.example.com/foo')
2048
2048
        self.assertIsInstance(r, type(t))
2049
2049
        self.assertEqual(t._parsed_url.user, r._parsed_url.user)
2050
 
        self.assertEquals('https://joe@foo.example.com/foo/', r.external_url())
 
2050
        self.assertEqual('https://joe@foo.example.com/foo/', r.external_url())
2051
2051
 
2052
2052
 
2053
2053
class PredefinedRequestHandler(http_server.TestingHTTPRequestHandler):