Commit 5efb57c7 authored by Michal Čihař's avatar Michal Čihař

Add tests for Mercurial support

Fixes #511
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent f0e2fbb2
......@@ -120,23 +120,36 @@ class RepoTestCase(TestCase):
self.addCleanup(shutil.rmtree, project.get_path(), True)
return project
def _create_subproject(self, file_format, mask, template='', new_base=''):
def _create_subproject(self, file_format, mask, template='',
new_base='', vcs='git'):
"""
Creates real test subproject.
"""
project = self.create_project()
if vcs == 'mercurial':
branch = 'default'
repo = self.hg_repo_path
push = self.hg_repo_path
else:
branch = 'master'
repo = self.git_repo_path
push = self.git_repo_path
return SubProject.objects.create(
name='Test',
slug='test',
project=project,
repo=self.git_repo_path,
push=self.git_repo_path,
repo=repo,
push=push,
branch=branch,
filemask=mask,
template=template,
file_format=file_format,
repoweb=REPOWEB_URL,
save_history=True,
new_base=new_base,
vcs=vcs
)
def create_subproject(self):
......@@ -154,6 +167,13 @@ class RepoTestCase(TestCase):
'po/*.po',
)
def create_po_mercurial(self):
return self._create_subproject(
'po',
'po/*.po',
vcs='mercurial'
)
def create_po_new_base(self):
return self._create_subproject(
'po',
......@@ -419,6 +439,10 @@ class SubProjectTest(RepoTestCase):
project = self.create_po()
self.verify_subproject(project, 3, 'cs', 4)
def test_create_po_mercurial(self):
project = self.create_po_mercurial()
self.verify_subproject(project, 3, 'cs', 4)
def test_create_po_link(self):
project = self.create_po_link()
self.verify_subproject(project, 3, 'cs', 4)
......
......@@ -334,6 +334,11 @@ class BasicResourceViewTest(BasicViewTest):
return self.create_android()
class BasicMercurialViewTest(BasicViewTest):
def create_subproject(self):
return self.create_po_mercurial()
class BasicPoMonoViewTest(BasicViewTest):
def create_subproject(self):
return self.create_po_mono()
......@@ -680,6 +685,11 @@ class EditResourceTest(EditTest):
return self.create_android()
class EditMercurialTest(EditTest):
def create_subproject(self):
return self.create_po_mercurial()
class EditPoMonoTest(EditTest):
def create_subproject(self):
return self.create_po_mono()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment