Changeset - 7172f3b0042b
[Not reviewed]
default
0 5 0
Mads Kiilerich - 6 years ago 2019-12-28 15:05:53
mads@kiilerich.com
Grafted from: d2190faa42a2
tests: minor updates for how py3 strings/bytes are different
5 files changed with 6 insertions and 7 deletions:
0 comments (0 inline, 0 general)
kallithea/tests/functional/test_admin_settings.py
Show inline comments
 
@@ -208,7 +208,7 @@ class TestAdminSettingsController(base.T
 
                                ))
 

	
 
            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)
kallithea/tests/functional/test_files.py
Show inline comments
 
@@ -482,13 +482,13 @@ class TestFilesController(base.TestContr
 
                                      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()
kallithea/tests/functional/test_login.py
Show inline comments
 
@@ -174,7 +174,7 @@ class TestLoginController(base.TestContr
 
            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')),
kallithea/tests/models/test_diff_parsers.py
Show inline comments
 
@@ -292,7 +292,6 @@ class TestDiffLib(base.TestController):
 
        #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'''
kallithea/tests/other/test_vcs_operations.py
Show inline comments
 
@@ -39,7 +39,7 @@ from tempfile import _RandomNameSequence
 
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 @@ class Command(object):
 
                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=''):
0 comments (0 inline, 0 general)