Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Copyright (C) Pootle contributors. | ||
# | ||
# This file is a part of the Pootle project. It is distributed under the GPL3 | ||
# or later license. See the LICENSE file for a copy of the license and the | ||
# AUTHORS file for copyright and authorship information. | ||
|
||
import pytest | ||
|
||
from django.core.urlresolvers import reverse | ||
|
||
|
||
@pytest.mark.django_db | ||
def test_view_vf_tp_translate_reverse(): | ||
# tp translate views | ||
tp_translate_view = reverse( | ||
"vfolder-pootle-tp-translate", | ||
kwargs=dict( | ||
vfolder_name="VF_NAME", | ||
language_code="LANG_CODE", | ||
project_code="PROJ_CODE")) | ||
assert ( | ||
tp_translate_view | ||
== u'/++vfolder/VF_NAME/LANG_CODE/PROJ_CODE/translate/') | ||
tp_translate_subdir_view = reverse( | ||
"vfolder-pootle-tp-translate", | ||
kwargs=dict( | ||
vfolder_name="VF_NAME", | ||
language_code="LANG_CODE", | ||
project_code="PROJ_CODE", | ||
dir_path="SOME/SUBDIR/")) | ||
assert ( | ||
tp_translate_subdir_view | ||
== u'/++vfolder/VF_NAME/LANG_CODE/PROJ_CODE/translate/SOME/SUBDIR/') | ||
|
||
|
||
@pytest.mark.django_db | ||
def test_view_vf_tp_translate_store_reverse(): | ||
tp_translate_store_view = reverse( | ||
"vfolder-pootle-tp-store-translate", | ||
kwargs=dict( | ||
vfolder_name="VF_NAME", | ||
language_code="LANG_CODE", | ||
project_code="PROJ_CODE", | ||
filename="FILE.EXT")) | ||
assert ( | ||
tp_translate_store_view | ||
== u'/++vfolder/VF_NAME/LANG_CODE/PROJ_CODE/translate/FILE.EXT') | ||
tp_translate_subdir_store_view = reverse( | ||
"vfolder-pootle-tp-store-translate", | ||
kwargs=dict( | ||
vfolder_name="VF_NAME", | ||
language_code="LANG_CODE", | ||
project_code="PROJ_CODE", | ||
dir_path="SOME/SUBDIR/", | ||
filename="FILE.EXT")) | ||
assert ( | ||
tp_translate_subdir_store_view | ||
== u'/++vfolder/VF_NAME/LANG_CODE/PROJ_CODE/translate/SOME/SUBDIR/FILE.EXT') | ||
|
||
|
||
@pytest.mark.pootle_vfolders | ||
@pytest.mark.django_db | ||
def test_views_vf_translate(vfolder_views, settings): | ||
from tp import _test_browse_view, _test_translate_view | ||
test_type, tp, request, response, kwargs = vfolder_views | ||
if test_type == "browse": | ||
_test_browse_view(tp, request, response, kwargs) | ||
elif test_type == "translate": | ||
_test_translate_view(tp, request, response, kwargs, settings) |