Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
deac2abe
Commit
deac2abe
authored
Feb 16, 2016
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve test coverage for automatic translation
Fixes #853 Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
83fd65be
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
10 deletions
+25
-10
weblate/trans/tests/test_autotranslate.py
weblate/trans/tests/test_autotranslate.py
+25
-10
No files found.
weblate/trans/tests/test_autotranslate.py
View file @
deac2abe
...
...
@@ -66,23 +66,38 @@ class AutoTranslationTest(ViewTestCase):
'Nazdar svete!
\
n
'
)
def
test_different
(
self
):
'''
Tests for automatic translation with different content.
'''
def
perform_auto
(
self
,
expected
=
1
,
**
kwargs
):
self
.
make_different
()
params
=
{
'project'
:
'test'
,
'lang'
:
'cs'
,
'subproject'
:
'test-2'
}
url
=
reverse
(
'auto_translation'
,
kwargs
=
params
)
response
=
self
.
client
.
post
(
url
,
follow
=
True
)
self
.
assertContains
(
response
,
'Automatic translation completed, 1 string was updated.'
,
)
response
=
self
.
client
.
post
(
url
,
kwargs
,
follow
=
True
)
if
expected
==
1
:
self
.
assertContains
(
response
,
'Automatic translation completed, 1 string was updated.'
,
)
else
:
self
.
assertContains
(
response
,
'Automatic translation completed, no strings were updated.'
,
)
self
.
assertRedirects
(
response
,
reverse
(
'translation'
,
kwargs
=
params
))
# Check we've translated something
translation
=
self
.
subproject2
.
translation_set
.
get
(
language_code
=
'cs'
)
self
.
assertEqual
(
translation
.
translated
,
1
)
self
.
assertEqual
(
translation
.
translated
,
expected
)
def
test_different
(
self
):
'''
Tests for automatic translation with different content.
'''
self
.
perform_auto
()
def
test_inconsistent
(
self
):
self
.
perform_auto
(
0
,
inconsistent
=
'1'
)
def
test_overwrite
(
self
):
self
.
perform_auto
(
overwrite
=
'1'
)
def
test_command
(
self
):
call_command
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment