| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| 1 import os | 1 import os |
| 2 import shutil | 2 import shutil |
| 3 import pytest | 3 import pytest |
| 4 from wsgi_intercept import urllib3_intercept | 4 from wsgi_intercept import urllib3_intercept |
| 5 from wsgi_intercept import add_wsgi_intercept | 5 from wsgi_intercept import add_wsgi_intercept |
| 6 from wsgi_intercept import remove_wsgi_intercept | 6 from wsgi_intercept import remove_wsgi_intercept |
| 7 | 7 |
| 8 from crowdin_mock_api import app | 8 from crowdin_mock_api import app |
| 9 from cms.bin import translate | 9 from cms.bin import translate |
| 10 | 10 |
| 11 | 11 |
| 12 @pytest.fixture(scope='module') | 12 @pytest.fixture(scope='module') |
| 13 def expect_requests(): | 13 def expect_requests(): |
| 14 return [ | 14 return [ |
| 15 ('info?key=test_key&json=1', ''), | 15 ('info?key=test_key&json=1', ''), |
| 16 ('supported-languages?key=test_key&json=1', ''), | 16 ('supported-languages?key=test_key&json=1', ''), |
| 17 ('add-file?key=test_key&json=1', 'translate.json'), | 17 ('add-file?key=test_key&json=1', 'translate.json'), |
| 18 ('upload-translation?key=test_key&json=1', 'test_sample'), | 18 ('upload-translation?key=test_key&json=1', 'simple'), |
|
Jon Sonesen
2018/01/19 04:45:37
Is this unrelated?
Vasily Kuznetsov
2018/01/19 15:34:29
This is needed because I renamed the translation s
| |
| 19 ('delete-file?key=test_key&json=1', 'translate.json'), | 19 ('delete-file?key=test_key&json=1', 'translate.json'), |
| 20 ('delete-file?key=test_key&json=1', 'translate.json'), | 20 ('delete-file?key=test_key&json=1', 'translate.json'), |
| 21 ('delete-directory?key=test_key&json=1', ''), | 21 ('delete-directory?key=test_key&json=1', ''), |
| 22 ('delete-directory?key=test_key&json=1', ''), | 22 ('delete-directory?key=test_key&json=1', ''), |
| 23 ('export?key=test_key&json=1', ''), | 23 ('export?key=test_key&json=1', ''), |
| 24 ('download/all.zip?key=test_key', ''), | 24 ('download/all.zip?key=test_key', ''), |
| 25 ] | 25 ] |
| 26 | 26 |
| 27 | 27 |
| 28 @pytest.fixture(scope='module') | 28 @pytest.fixture(scope='module') |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 43 yield None | 43 yield None |
| 44 remove_wsgi_intercept() | 44 remove_wsgi_intercept() |
| 45 | 45 |
| 46 | 46 |
| 47 def test_sync(temp_site, make_intercept, make_crowdin_zip, expect_requests): | 47 def test_sync(temp_site, make_intercept, make_crowdin_zip, expect_requests): |
| 48 translate.crowdin_sync(temp_site, 'test_key') | 48 translate.crowdin_sync(temp_site, 'test_key') |
| 49 for (url, data), (expect_url, expect_data) in zip(app.request_log, | 49 for (url, data), (expect_url, expect_data) in zip(app.request_log, |
| 50 expect_requests): | 50 expect_requests): |
| 51 assert expect_url in url | 51 assert expect_url in url |
| 52 assert expect_data in data | 52 assert expect_data in data |
| OLD | NEW |