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
b4ac990a
Commit
b4ac990a
authored
Oct 24, 2013
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test Google translate API as well
parent
31f867b6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
2 deletions
+20
-2
trans/tests/test_machine.py
trans/tests/test_machine.py
+17
-2
weblate/settings_test.py
weblate/settings_test.py
+3
-0
No files found.
trans/tests/test_machine.py
View file @
b4ac990a
...
...
@@ -31,7 +31,7 @@ from trans.machine.opentran import OpenTranTranslation
from
trans.machine.apertium
import
ApertiumTranslation
from
trans.machine.tmserver
import
AmagamaTranslation
from
trans.machine.microsoft
import
MicrosoftTranslation
from
trans.machine.google
import
GoogleWebTranslation
from
trans.machine.google
import
GoogleWebTranslation
,
GoogleTranslation
from
trans.machine.weblatetm
import
(
WeblateSimilarTranslation
,
WeblateTranslation
)
...
...
@@ -221,7 +221,7 @@ class MachineTranslationTest(TestCase):
self
.
assertTranslate
(
machine
)
@
httpretty
.
activate
def
test_google
(
self
):
def
test_google
web
(
self
):
httpretty
.
register_uri
(
httpretty
.
GET
,
'http://translate.google.com/translate_a/t'
,
...
...
@@ -230,6 +230,21 @@ class MachineTranslationTest(TestCase):
machine
=
GoogleWebTranslation
()
self
.
assertTranslate
(
machine
)
@
httpretty
.
activate
def
test_google
(
self
):
httpretty
.
register_uri
(
httpretty
.
GET
,
'https://www.googleapis.com/language/translate/v2/languages'
,
body
=
'{"data": {"languages": [ { "language": "cs" }]}}'
)
httpretty
.
register_uri
(
httpretty
.
GET
,
'https://www.googleapis.com/language/translate/v2/'
,
body
=
'{"data":{"translations":[{"translatedText":"svet"}]}}'
)
machine
=
GoogleTranslation
()
self
.
assertTranslate
(
machine
)
@
httpretty
.
activate
def
test_amagama
(
self
):
httpretty
.
register_uri
(
...
...
weblate/settings_test.py
View file @
b4ac990a
...
...
@@ -34,6 +34,9 @@ SOUTH_TESTS_MIGRATE = False
MT_MICROSOFT_ID
=
'ID'
MT_MICROSOFT_SECRET
=
'SECRET'
# Fake Google translate API key
MT_GOOGLE_KEY
=
'KEY'
# To get higher limit for testing
MT_MYMEMORY_EMAIL
=
'test@weblate.org'
...
...
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