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
 
@@ -205,10 +205,10 @@ class TestAdminSettingsController(base.T
 
                                 captcha_private_key='',
 
                                 captcha_public_key='',
 
                                 _session_csrf_secret_token=self.session_csrf_secret_token(),
 
                                ))
 

	
 
            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
 
@@ -479,19 +479,19 @@ class TestFilesController(base.TestContr
 
        self.log_user()
 
        response = self.app.get(base.url('files_edit_home',
 
                                      repo_name=base.HG_REPO,
 
                                      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()
 
        repo = fixture.create_repo(u'test-edit-repo', repo_type='hg')
 

	
 
        ## add file
kallithea/tests/functional/test_login.py
Show inline comments
 
@@ -171,13 +171,13 @@ class TestLoginController(base.TestContr
 
            response = self.app.get(base.url(controller='summary', action='index',
 
                                        repo_name=base.HG_REPO,
 
                                        **args))
 
            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')),
 
        ({'blue': u'blå', 'green':u'grøn'},
 
             ('blue=bl%C3%A5', 'green=gr%C3%B8n')),
 
    ])
kallithea/tests/models/test_diff_parsers.py
Show inline comments
 
@@ -289,13 +289,12 @@ class TestDiffLib(base.TestController):
 
        diff_processor = DiffProcessor(raw_diff)
 
        chunks = diff_processor.parsed[0]['chunks']
 
        assert not chunks[0]
 
        #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'''
 
context ... ... '@@ -51,6 +51,13 @@\n'
 
unmod    51  51 '<u>\t</u>begin();\n'
 
unmod    52  52 '<u>\t</u>\n'
kallithea/tests/other/test_vcs_operations.py
Show inline comments
 
@@ -36,13 +36,13 @@ import urllib.request
 
from subprocess import PIPE, Popen
 
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
 
from kallithea.model.user import UserModel
 
from kallithea.tests import base
 
from kallithea.tests.fixture import Fixture
 
@@ -160,13 +160,13 @@ class Command(object):
 
            if stdout:
 
                print('stdout:', stdout)
 
            if stderr:
 
                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=''):
 
    return tempfile.mkdtemp(dir=base.TESTS_TMP_PATH, prefix=prefix, suffix=suffix)
 

	
 

	
0 comments (0 inline, 0 general)