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
95a2b504
Commit
95a2b504
authored
9 years ago
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make mt tests work even without specific configuration
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
df6f1be0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
weblate/trans/tests/test_js_views.py
weblate/trans/tests/test_js_views.py
+11
-0
No files found.
weblate/trans/tests/test_js_views.py
View file @
95a2b504
...
...
@@ -23,6 +23,8 @@ Tests for AJAX/JS views.
"""
from
weblate.trans.tests.test_views
import
ViewTestCase
from
weblate.trans.util
import
load_class
from
weblate.trans.machine
import
MACHINE_TRANSLATION_SERVICES
from
django.core.urlresolvers
import
reverse
import
json
...
...
@@ -31,6 +33,13 @@ class JSViewsTest(ViewTestCase):
'''
Testing of AJAX/JS views.
'''
def
ensure_dummy_mt
(
self
):
"""Ensures we have dummy mt installed"""
if
'dummy'
in
MACHINE_TRANSLATION_SERVICES
:
return
name
=
'weblate.trans.machine.dummy.DummyTranslation'
service
=
load_class
(
name
,
'TEST'
)()
MACHINE_TRANSLATION_SERVICES
[
service
.
mtid
]
=
service
def
test_get_string
(
self
):
unit
=
self
.
get_unit
()
...
...
@@ -57,6 +66,7 @@ class JSViewsTest(ViewTestCase):
self
.
assertContains
(
response
,
'Czech'
)
def
test_translate
(
self
):
self
.
ensure_dummy_mt
()
unit
=
self
.
get_unit
()
response
=
self
.
client
.
get
(
reverse
(
'js-translate'
,
kwargs
=
{
'unit_id'
:
unit
.
id
}),
...
...
@@ -97,6 +107,7 @@ class JSViewsTest(ViewTestCase):
self
.
assertContains
(
response
,
'href="/changes/?'
)
def
test_mt_services
(
self
):
self
.
ensure_dummy_mt
()
response
=
self
.
client
.
get
(
reverse
(
'js-mt-services'
))
self
.
assertEqual
(
response
.
status_code
,
200
)
data
=
json
.
loads
(
response
.
content
)
...
...
This diff is collapsed.
Click to expand it.
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