view rhodecode/tests/vcs/test_filenodes_unicode_path.py @ 3651:659bd922520e beta

config: rename options to show_revision_number and show_sha_length 'sha_show_numeric_rev' had nothing to do with the sha value. The revision numbers are kind of native to Mercurial and there they are known as 'revision numbers'. 'sha_len' was very short and didn't clarify that it only controlled what was shown. These settings are currently only used in the changelog, but they should be used everywhere.
author Mads Kiilerich <madski@unity3d.com>
date Wed, 03 Apr 2013 15:56:12 +0200
parents 402a96fcfa22
children d7488551578e
line wrap: on
line source

# encoding: utf8

from __future__ import with_statement

import datetime
from rhodecode.lib.vcs.nodes import FileNode
from rhodecode.lib.vcs.utils.compat import unittest
from test_inmemchangesets import BackendBaseTestCase
from conf import SCM_TESTS


class FileNodeUnicodePathTestsMixin(object):

    fname = 'ąśðąęłąć.txt'
    ufname = (fname).decode('utf-8')

    def get_commits(self):
        self.nodes = [
            FileNode(self.fname, content='Foobar'),
        ]

        commits = [
            {
                'message': 'Initial commit',
                'author': 'Joe Doe <joe.doe@example.com>',
                'date': datetime.datetime(2010, 1, 1, 20),
                'added': self.nodes,
            },
        ]
        return commits

    def test_filenode_path(self):
        node = self.tip.get_node(self.fname)
        unode = self.tip.get_node(self.ufname)
        self.assertEqual(node, unode)


for alias in SCM_TESTS:
    attrs = {
        'backend_alias': alias,
    }
    cls_name = ''.join(('%s file node unicode path test' % alias).title()
        .split())
    bases = (FileNodeUnicodePathTestsMixin, BackendBaseTestCase)
    globals()[cls_name] = type(cls_name, bases, attrs)


if __name__ == '__main__':
    unittest.main()