Commit 6db7ecc9 authored by Weblate's avatar Weblate

Merge remote-tracking branch 'origin/master'

parents 81ba8eba babf3f85
......@@ -19,3 +19,9 @@ PROJECT_APPS = (
)
PYLINT_RCFILE = os.path.join(WEB_ROOT, '..', 'pylint.rc')
# Different root for test repos
GIT_ROOT = '%s/test-repos/' % WEB_ROOT
# Avoid migrating during testsuite
SOUTH_TESTS_MIGRATE = False
......@@ -81,3 +81,16 @@ class WeblateCommand(BaseCommand):
result |= found
return result
class WeblateLangCommand(WeblateCommand):
option_list = WeblateCommand.option_list + (
make_option(
'--lang',
action='store',
type='string',
dest='lang',
default=None,
help='Limit only to given languages (comma separated list)'
),
)
......@@ -18,13 +18,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from weblate.trans.management.commands import WeblateCommand
from weblate.trans.management.commands import WeblateLangCommand
from django.utils import timezone
from datetime import timedelta
from optparse import make_option
class Command(WeblateCommand):
class Command(WeblateLangCommand):
help = 'commits pending changes older than given age'
option_list = WeblateCommand.option_list + (
make_option(
......@@ -35,14 +35,6 @@ class Command(WeblateCommand):
default=24,
help='Age of changes to commit in hours (default is 24 hours)'
),
make_option(
'--lang',
action='store',
type='string',
dest='lang',
default=None,
help='Limit only to given languages (comma separated list)'
),
)
def handle(self, *args, **options):
......
......@@ -18,13 +18,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from weblate.trans.management.commands import WeblateCommand
from weblate.trans.management.commands import WeblateLangCommand
from optparse import make_option
class Command(WeblateCommand):
class Command(WeblateLangCommand):
help = '(re)loads translations from disk'
option_list = WeblateCommand.option_list + (
option_list = WeblateLangCommand.option_list + (
make_option(
'--force',
action='store_true',
......@@ -32,14 +32,6 @@ class Command(WeblateCommand):
default=False,
help='Force rereading files even when they should be up to date'
),
make_option(
'--lang',
action='store',
type='string',
dest='lang',
default=None,
help='Limit only to given languages (comma separated list)'
),
)
def handle(self, *args, **options):
......
from test_checks import *
from test_models import *
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2013 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <http://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
"""
Tests for translation models.
"""
from django.test import TestCase
from django.conf import settings
import shutil
import os
from weblate.trans.models import (
Project,
)
class RepoTestCase(TestCase):
'''
Generic class for tests working with repositories.
'''
def setUp(self):
if 'test-repos' in settings.GIT_ROOT:
if os.path.exists(settings.GIT_ROOT):
shutil.rmtree(settings.GIT_ROOT)
def create_project(self):
'''
Creates test project.
'''
return Project.objects.create(
name='Test',
slug='test',
web='http://weblate.org/'
)
class ProjectTest(RepoTestCase):
'''
Project object testing.
'''
def test_create(self):
project = self.create_project()
self.assertTrue(os.path.exists(project.get_path()))
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