| Index: tests/utils.py |
| diff --git a/tests/utils.py b/tests/utils.py |
| index ed21e24c650e59651cd2a6edcf9d1cd915c9a38e..6adb753362a82b8c14beb2be7f1817ed2a7bb59a 100644 |
| --- a/tests/utils.py |
| +++ b/tests/utils.py |
| @@ -23,6 +23,10 @@ from io import BytesIO |
| import pytest |
| +from cms.translations.xtm.projects_handler import ( |
| + create_project, upload_files, download_files, |
| +) |
| + |
| def get_dir_contents(path): |
| # TODO: This function is duplicated in test_page_outputs.py. |
| @@ -80,7 +84,52 @@ def create_in_memory_zip(file_names, file_data): |
| def exception_test(func, exception, exp_msg, *args, **kw): |
| + """Test if a function raises the correct exception. |
| + |
| + Parameters |
| + ---------- |
| + func: function |
| + The function we're testing. |
| + exception: classobj |
| + The exception we expect to be raised. |
| + exp_msg: str |
| + The message we expect the exception to contain. |
| + |
| + """ |
| with pytest.raises(exception) as err: |
| func(*args, **kw) |
| assert exp_msg in str(err.value) |
| + |
| + |
| +class XtmMockArgs: |
| + |
| + class CreationArgsNamespace: |
| + def __init__(self): |
|
Vasily Kuznetsov
2018/10/16 14:52:54
You don't really need these empty __init__'s, not
Tudor Avram
2018/10/18 16:29:23
Done.
|
| + pass |
| + |
| + name = 'bar' |
| + desc = 'foo' |
| + client_id = 10 |
| + ref_id = 'faz' |
| + workflow_id = 20 |
| + save_id = False |
| + source_dir = None |
| + projects_func = staticmethod(create_project) |
| + source_lang = 'en_US' |
| + workflow_name = None |
| + |
| + class UploadArgsNamespace: |
| + def __init__(self): |
| + pass |
| + |
| + source_dir = None |
| + projects_func = staticmethod(upload_files) |
| + no_overwrite = False |
| + |
| + class DownloadArgsNamespace: |
| + def __init__(self): |
| + pass |
| + |
| + source_dir = None |
| + projects_func = staticmethod(download_files) |