##// END OF EJS Templates
vcs: always return bytes from node.content...
vcs: always return bytes from node.content We will rather have the unicode conversions explicit. Note: Py3 bytes doesn't have .startswith - replace that with a regexp.

File last commit:

r7250:e2519d2e default
r7942:9203621c default
Show More
test_filenodes_unicode_path.py
41 lines | 1017 B | text/x-python | PythonLexer
/ kallithea / tests / vcs / test_filenodes_unicode_path.py
# encoding: utf-8
import datetime
from kallithea.lib.vcs.nodes import FileNode
from kallithea.tests.vcs.base import _BackendTestMixin
class FileNodeUnicodePathTestsMixin(_BackendTestMixin):
fname = 'ąśðąęłąć.txt'
ufname = (fname).decode('utf-8')
@classmethod
def _get_commits(cls):
cls.nodes = [
FileNode(cls.fname, content='Foobar'),
]
commits = [
{
'message': 'Initial commit',
'author': 'Joe Doe <joe.doe@example.com>',
'date': datetime.datetime(2010, 1, 1, 20),
'added': cls.nodes,
},
]
return commits
def test_filenode_path(self):
node = self.tip.get_node(self.fname)
unode = self.tip.get_node(self.ufname)
assert node == unode
class TestGitFileNodeUnicodePath(FileNodeUnicodePathTestsMixin):
backend_alias = 'git'
class TestHgFileNodeUnicodePath(FileNodeUnicodePathTestsMixin):
backend_alias = 'hg'