Mercurial > hg-stable
changeset 37939:e0598133ac68
tests: migrate test-wsgirequest.py to Python 3
# skip-blame adding and removing b prefixes
Differential Revision: https://phab.mercurial-scm.org/D3495
author | Augie Fackler <augie@google.com> |
---|---|
date | Fri, 27 Apr 2018 10:40:04 -0400 |
parents | 2f00c6e8f6a1 |
children | 03a09579c854 |
files | contrib/python3-whitelist tests/test-wsgirequest.py |
diffstat | 2 files changed, 17 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/python3-whitelist Fri Apr 27 10:31:49 2018 -0400 +++ b/contrib/python3-whitelist Fri Apr 27 10:40:04 2018 -0400 @@ -464,4 +464,5 @@ test-wireproto-clientreactor.py test-wireproto-framing.py test-wireproto-serverreactor.py +test-wsgirequest.py test-xdg.t
--- a/tests/test-wsgirequest.py Fri Apr 27 10:31:49 2018 -0400 +++ b/tests/test-wsgirequest.py Fri Apr 27 10:40:04 2018 -0400 @@ -206,18 +206,18 @@ """repository path components get stripped from URL.""" with self.assertRaisesRegex(error.ProgrammingError, - b'reponame requires PATH_INFO'): + 'reponame requires PATH_INFO'): parse(DEFAULT_ENV, reponame=b'repo') with self.assertRaisesRegex(error.ProgrammingError, - b'PATH_INFO does not begin with repo ' - b'name'): + 'PATH_INFO does not begin with repo ' + 'name'): parse(DEFAULT_ENV, reponame=b'repo', extra={ r'PATH_INFO': r'/pathinfo', }) with self.assertRaisesRegex(error.ProgrammingError, - b'reponame prefix of PATH_INFO'): + 'reponame prefix of PATH_INFO'): parse(DEFAULT_ENV, reponame=b'repo', extra={ r'PATH_INFO': r'/repoextra/path', }) @@ -251,7 +251,7 @@ def testaltbaseurl(self): # Simple hostname remap. - r = parse(DEFAULT_ENV, altbaseurl='http://altserver') + r = parse(DEFAULT_ENV, altbaseurl=b'http://altserver') self.assertEqual(r.url, b'http://testserver') self.assertEqual(r.baseurl, b'http://testserver') @@ -264,7 +264,7 @@ self.assertIsNone(r.reponame) # With a custom port. - r = parse(DEFAULT_ENV, altbaseurl='http://altserver:8000') + r = parse(DEFAULT_ENV, altbaseurl=b'http://altserver:8000') self.assertEqual(r.url, b'http://testserver') self.assertEqual(r.baseurl, b'http://testserver') self.assertEqual(r.advertisedurl, b'http://altserver:8000') @@ -276,7 +276,7 @@ self.assertIsNone(r.reponame) # With a changed protocol. - r = parse(DEFAULT_ENV, altbaseurl='https://altserver') + r = parse(DEFAULT_ENV, altbaseurl=b'https://altserver') self.assertEqual(r.url, b'http://testserver') self.assertEqual(r.baseurl, b'http://testserver') self.assertEqual(r.advertisedurl, b'https://altserver') @@ -289,7 +289,7 @@ self.assertIsNone(r.reponame) # Need to specify explicit port number for proper https:// alt URLs. - r = parse(DEFAULT_ENV, altbaseurl='https://altserver:443') + r = parse(DEFAULT_ENV, altbaseurl=b'https://altserver:443') self.assertEqual(r.url, b'http://testserver') self.assertEqual(r.baseurl, b'http://testserver') self.assertEqual(r.advertisedurl, b'https://altserver') @@ -301,7 +301,7 @@ self.assertIsNone(r.reponame) # With only PATH_INFO defined. - r = parse(DEFAULT_ENV, altbaseurl='http://altserver', extra={ + r = parse(DEFAULT_ENV, altbaseurl=b'http://altserver', extra={ r'PATH_INFO': r'/path1/path2', }) self.assertEqual(r.url, b'http://testserver/path1/path2') @@ -315,7 +315,7 @@ self.assertIsNone(r.reponame) # Path on alt URL. - r = parse(DEFAULT_ENV, altbaseurl='http://altserver/altpath') + r = parse(DEFAULT_ENV, altbaseurl=b'http://altserver/altpath') self.assertEqual(r.url, b'http://testserver') self.assertEqual(r.baseurl, b'http://testserver') self.assertEqual(r.advertisedurl, b'http://altserver/altpath') @@ -327,7 +327,7 @@ self.assertIsNone(r.reponame) # With a trailing slash. - r = parse(DEFAULT_ENV, altbaseurl='http://altserver/altpath/') + r = parse(DEFAULT_ENV, altbaseurl=b'http://altserver/altpath/') self.assertEqual(r.url, b'http://testserver') self.assertEqual(r.baseurl, b'http://testserver') self.assertEqual(r.advertisedurl, b'http://altserver/altpath/') @@ -339,7 +339,7 @@ self.assertIsNone(r.reponame) # PATH_INFO + path on alt URL. - r = parse(DEFAULT_ENV, altbaseurl='http://altserver/altpath', extra={ + r = parse(DEFAULT_ENV, altbaseurl=b'http://altserver/altpath', extra={ r'PATH_INFO': r'/path1/path2', }) self.assertEqual(r.url, b'http://testserver/path1/path2') @@ -354,7 +354,7 @@ self.assertIsNone(r.reponame) # PATH_INFO + path on alt URL with trailing slash. - r = parse(DEFAULT_ENV, altbaseurl='http://altserver/altpath/', extra={ + r = parse(DEFAULT_ENV, altbaseurl=b'http://altserver/altpath/', extra={ r'PATH_INFO': r'/path1/path2', }) self.assertEqual(r.url, b'http://testserver/path1/path2') @@ -369,7 +369,7 @@ self.assertIsNone(r.reponame) # Local SCRIPT_NAME is ignored. - r = parse(DEFAULT_ENV, altbaseurl='http://altserver', extra={ + r = parse(DEFAULT_ENV, altbaseurl=b'http://altserver', extra={ r'SCRIPT_NAME': r'/script', r'PATH_INFO': r'/path1/path2', }) @@ -384,7 +384,7 @@ self.assertIsNone(r.reponame) # Use remote's path for script name, app path - r = parse(DEFAULT_ENV, altbaseurl='http://altserver/altroot', extra={ + r = parse(DEFAULT_ENV, altbaseurl=b'http://altserver/altroot', extra={ r'SCRIPT_NAME': r'/script', r'PATH_INFO': r'/path1/path2', }) @@ -401,7 +401,7 @@ # reponame is factored in properly. r = parse(DEFAULT_ENV, reponame=b'repo', - altbaseurl='http://altserver/altroot', + altbaseurl=b'http://altserver/altroot', extra={ r'SCRIPT_NAME': r'/script', r'PATH_INFO': r'/repo/path1/path2',