Commit 7da4e0b6 authored by Michal Čihař's avatar Michal Čihař

Fixed command testcases to work with Django 1.5

Since Django 1.5 CommandError is raised further instead of changing it
to SystemExist as was the case before.
parent d2e3ad8c
......@@ -24,8 +24,15 @@ Tests for management commands.
from trans.tests.models import RepoTestCase
from django.core.management import call_command
import django
from trans.search import flush_index
# Django 1.5 changes behavior here
if django.VERSION >= (1, 5):
COMMAND_EXCEPTION = CommandError
else:
COMMAND_EXCEPTION = SystemExit
class ImportProjectTest(RepoTestCase):
def test_import(self):
......@@ -84,7 +91,7 @@ class ImportProjectTest(RepoTestCase):
Test of correct handling of missing project.
'''
self.assertRaises(
SystemExit,
COMMAND_EXCEPTION,
call_command,
'import_project',
'test',
......@@ -99,7 +106,7 @@ class ImportProjectTest(RepoTestCase):
'''
self.create_project()
self.assertRaises(
SystemExit,
COMMAND_EXCEPTION,
call_command,
'import_project',
'test',
......@@ -159,14 +166,14 @@ class CheckGitTest(RepoTestCase):
def test_nonexisting_project(self):
self.assertRaises(
SystemExit,
COMMAND_EXCEPTION,
self.do_test,
'notest',
)
def test_nonexisting_subproject(self):
self.assertRaises(
SystemExit,
COMMAND_EXCEPTION,
self.do_test,
'test/notest',
)
......
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