Index: tests/test_translations.py |
=================================================================== |
new file mode 100644 |
--- /dev/null |
+++ b/tests/test_translations.py |
@@ -0,0 +1,32 @@ |
+import os |
+import shutil |
+import pytest |
+import mock_api |
+from wsgi_intercept import urllib3_intercept |
+from wsgi_intercept import add_wsgi_intercept |
+from wsgi_intercept import remove_wsgi_intercept |
+ |
+from cms.bin import translate |
+ |
+ |
+@pytest.fixture(scope='module') |
+def make_crowdin_zip(temp_site): |
+ zip_name = os.path.join('tests', 'all') |
+ input_dir = os.path.join(temp_site, 'locales') |
+ shutil.make_archive(zip_name, 'zip', input_dir) |
Jon Sonesen
2016/09/30 07:33:56
the archive is not made in the temp site because t
|
+ yield None |
+ os.remove(zip_name + '.zip') |
+ |
+ |
+@pytest.fixture() |
+def make_intercept(scope='module'): |
+ host = 'api.crowdin.com' |
+ port = 443 |
+ urllib3_intercept.install() |
+ add_wsgi_intercept(host, port, lambda: mock_api.app.wsgi_app) |
+ yield None |
+ remove_wsgi_intercept() |
+ |
+ |
+def test_sync(temp_site, make_intercept, make_crowdin_zip): |
+ translate.crowdin_sync(temp_site, 'test_key') |
Vasily Kuznetsov
2016/09/30 14:38:31
As we discussed, we should add assertions to this
|