Mercurial > kallithea
changeset 8206:7172f3b0042b
tests: minor updates for how py3 strings/bytes are different
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Sat, 28 Dec 2019 15:05:53 +0100 |
parents | 1c64d9bd0599 |
children | 141066b8a89a |
files | kallithea/tests/functional/test_admin_settings.py kallithea/tests/functional/test_files.py kallithea/tests/functional/test_login.py kallithea/tests/models/test_diff_parsers.py kallithea/tests/other/test_vcs_operations.py |
diffstat | 5 files changed, 6 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/tests/functional/test_admin_settings.py Sat Dec 28 18:21:50 2019 +0100 +++ b/kallithea/tests/functional/test_admin_settings.py Sat Dec 28 15:05:53 2019 +0100 @@ -208,7 +208,7 @@ )) self.checkSessionFlash(response, 'Updated application settings') - assert Setting.get_app_settings()['title'] == new_title.decode('utf-8') + assert Setting.get_app_settings()['title'] == new_title response = response.follow() response.mustcontain("""<span class="branding">%s</span>""" % new_title)
--- a/kallithea/tests/functional/test_files.py Sat Dec 28 18:21:50 2019 +0100 +++ b/kallithea/tests/functional/test_files.py Sat Dec 28 15:05:53 2019 +0100 @@ -482,13 +482,13 @@ revision='tip', f_path='vcs/nodes.py')) # Odd error when on tip ... self.checkSessionFlash(response, "You can only edit files with revision being a valid branch") - assert "Commit Message" not in response.body + assert b"Commit Message" not in response.body # Specify branch head revision to avoid "valid branch" error and get coverage of edit form response = self.app.get(base.url('files_edit_home', repo_name=base.HG_REPO, revision='96507bd11ecc815ebc6270fdf6db110928c09c1e', f_path='vcs/nodes.py')) - assert "Commit Message" in response.body + assert b"Commit Message" in response.body def test_edit_file_view_not_on_branch_hg(self): self.log_user()
--- a/kallithea/tests/functional/test_login.py Sat Dec 28 18:21:50 2019 +0100 +++ b/kallithea/tests/functional/test_login.py Sat Dec 28 15:05:53 2019 +0100 @@ -174,7 +174,7 @@ assert response.status == '302 Found' came_from = urllib.parse.parse_qs(urllib.parse.urlparse(response.location).query)['came_from'][0] came_from_qs = urllib.parse.parse_qsl(urllib.parse.urlparse(came_from).query) - assert sorted(came_from_qs) == sorted((k, v.encode('utf-8')) for k, v in args.items()) + assert sorted(came_from_qs) == sorted(args.items()) @base.parametrize('args,args_encoded', [ ({'foo':'one', 'bar':'two'}, ('foo=one', 'bar=two')),
--- a/kallithea/tests/models/test_diff_parsers.py Sat Dec 28 18:21:50 2019 +0100 +++ b/kallithea/tests/models/test_diff_parsers.py Sat Dec 28 15:05:53 2019 +0100 @@ -292,7 +292,6 @@ #from pprint import pprint; pprint(chunks[1]) l = ['\n'] for d in chunks[1]: - d['line'] = d['line'].encode() # not needed for py3 l.append('%(action)-7s %(new_lineno)3s %(old_lineno)3s %(line)r\n' % d) s = ''.join(l) assert s == r'''
--- a/kallithea/tests/other/test_vcs_operations.py Sat Dec 28 18:21:50 2019 +0100 +++ b/kallithea/tests/other/test_vcs_operations.py Sat Dec 28 15:05:53 2019 +0100 @@ -39,7 +39,7 @@ import pytest from kallithea import CONFIG -from kallithea.lib.utils2 import ascii_bytes +from kallithea.lib.utils2 import ascii_bytes, safe_str from kallithea.model.db import CacheInvalidation, Repository, Ui, User, UserIpMap, UserLog from kallithea.model.meta import Session from kallithea.model.ssh_key import SshKeyModel @@ -163,7 +163,7 @@ print('stderr:', stderr) if not ignoreReturnCode: assert p.returncode == 0 - return stdout, stderr + return safe_str(stdout), safe_str(stderr) def _get_tmp_dir(prefix='vcs_operations-', suffix=''):