# HG changeset patch # User Mads Kiilerich # Date 1496105985 -7200 # Node ID 5eb412b5d3651acda98f89bec3da4afac00b81a9 # Parent fbc588a09811dfb42ffded83ee2b4a9e3da7feb3 tests: add test coverage for forking repos to unicode names So far it works ... diff -r fbc588a09811 -r 5eb412b5d365 kallithea/tests/functional/test_forks.py --- a/kallithea/tests/functional/test_forks.py Tue May 30 02:59:45 2017 +0200 +++ b/kallithea/tests/functional/test_forks.py Tue May 30 02:59:45 2017 +0200 @@ -1,10 +1,12 @@ # -*- coding: utf-8 -*- +import urllib import unittest from kallithea.tests.base import * from kallithea.tests.fixture import Fixture +from kallithea.lib.utils2 import safe_str, safe_unicode from kallithea.model.db import Repository from kallithea.model.repo import RepoModel from kallithea.model.user import UserModel @@ -133,6 +135,36 @@ fixture.destroy_repo(fork_name_full) fixture.destroy_repo_group(group_id) + def test_fork_unicode(self): + self.log_user() + + # create a fork + repo_name = self.REPO + org_repo = Repository.get_by_repo_name(repo_name) + fork_name = safe_str(self.REPO_FORK + u'-rødgrød') + creation_args = { + 'repo_name': fork_name, + 'repo_group': u'-1', + 'fork_parent_id': org_repo.repo_id, + 'repo_type': self.REPO_TYPE, + 'description': 'unicode repo 1', + 'private': 'False', + 'landing_rev': 'rev:tip', + '_authentication_token': self.authentication_token()} + self.app.post(url(controller='forks', action='fork_create', + repo_name=repo_name), creation_args) + response = self.app.get(url(controller='forks', action='forks', + repo_name=repo_name)) + response.mustcontain( + """%s""" % (urllib.quote(fork_name), fork_name) + ) + fork_repo = Repository.get_by_repo_name(safe_unicode(fork_name)) + assert fork_repo + + # remove this fork + response = self.app.post(url('delete_repo', repo_name=fork_name), + params={'_authentication_token': self.authentication_token()}) + def test_z_fork_create(self): self.log_user() fork_name = self.REPO_FORK