Files @ 67cb7f56d7f4
Branch filter:

Location: kallithea/kallithea/tests/vcs/test_filenodes_unicode_path.py

Thomas De Schampheleire
tests: vcs: use _BackendTestMixin instead of duplicated BackendBaseTestCase in test_filenodes_unicode_path

test_inmemchangesets.py hosts a second base class in addition to
_BackendTestMixin, which is basically a duplication we want to get rid of.

As that duplicated base class BackendBaseTestCase is still in use by
test_filenodes_unicode_path.py, we first need to let that test use the main
base class.
# encoding: utf8

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'