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
d1a6ca88
Commit
d1a6ca88
authored
Oct 08, 2015
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Actually test automatic translation with some content
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
01458901
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
7 deletions
+39
-7
weblate/trans/tests/test_views.py
weblate/trans/tests/test_views.py
+39
-7
No files found.
weblate/trans/tests/test_views.py
View file @
d1a6ca88
...
...
@@ -34,8 +34,7 @@ from django.contrib.messages.storage.fallback import FallbackStorage
from
django.core
import
mail
from
PIL
import
Image
from
weblate.trans.models.whiteboard
import
WhiteboardMessage
from
weblate.trans.models.changes
import
Change
from
weblate.trans.models
import
Change
,
WhiteboardMessage
,
SubProject
from
weblate.trans.tests.test_models
import
RepoTestCase
from
weblate.accounts.models
import
Profile
from
weblate.trans.tests
import
OverrideSettings
...
...
@@ -952,17 +951,50 @@ class SourceStringsTest(ViewTestCase):
class
AutoTranslationTest
(
ViewTestCase
):
def
test_auto
(
self
):
'''
Tests for automatic translation.
'''
def
setUp
(
self
):
super
(
AutoTranslationTest
,
self
).
setUp
()
# Need extra power
self
.
user
.
is_superuser
=
True
self
.
user
.
save
()
self
.
subproject2
=
SubProject
.
objects
.
create
(
name
=
'Test 2'
,
slug
=
'test-2'
,
project
=
self
.
project
,
repo
=
self
.
git_repo_path
,
push
=
self
.
git_repo_path
,
vcs
=
'git'
,
filemask
=
'po/*.po'
,
template
=
''
,
file_format
=
'po'
,
new_base
=
''
,
allow_translation_propagation
=
False
,
)
# Default params
def
test_none
(
self
):
'''
Tests for automatic translation with no content.
'''
url
=
reverse
(
'auto_translation'
,
kwargs
=
self
.
kw_translation
)
response
=
self
.
client
.
post
(
url
)
self
.
assertRedirects
(
response
,
self
.
translation_url
)
def
test_different
(
self
):
'''
Tests for automatic translation with different content.
'''
response
=
self
.
edit_unit
(
'Hello, world!
\
n
'
,
'Nazdar svete!
\
n
'
)
url
=
reverse
(
'auto_translation'
,
kwargs
=
{
'project'
:
'test'
,
'lang'
:
'cs'
,
'subproject'
:
'test-2'
}
)
response
=
self
.
client
.
post
(
url
)
# Check we've translated something
translation
=
self
.
subproject2
.
translation_set
.
get
(
language_code
=
'cs'
)
self
.
assertEqual
(
translation
.
translated
,
1
)
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