| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 # This file is part of the Adblock Plus web scripts, | 1 # This file is part of the Adblock Plus web scripts, |
| 2 # Copyright (C) 2006-present eyeo GmbH | 2 # Copyright (C) 2006-present eyeo GmbH |
| 3 # | 3 # |
| 4 # Adblock Plus is free software: you can redistribute it and/or modify | 4 # Adblock Plus is free software: you can redistribute it and/or modify |
| 5 # it under the terms of the GNU General Public License version 3 as | 5 # it under the terms of the GNU General Public License version 3 as |
| 6 # published by the Free Software Foundation. | 6 # published by the Free Software Foundation. |
| 7 # | 7 # |
| 8 # Adblock Plus is distributed in the hope that it will be useful, | 8 # Adblock Plus is distributed in the hope that it will be useful, |
| 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 The message we expect the exception to contain. | 96 The message we expect the exception to contain. |
| 97 | 97 |
| 98 """ | 98 """ |
| 99 with pytest.raises(exception) as err: | 99 with pytest.raises(exception) as err: |
| 100 func(*args, **kw) | 100 func(*args, **kw) |
| 101 | 101 |
| 102 assert exp_msg in str(err.value) | 102 assert exp_msg in str(err.value) |
| 103 | 103 |
| 104 | 104 |
| 105 class XtmMockArgs: | 105 class XtmMockArgs: |
| 106 """Mock arguments for the XTM integration script.""" | |
|
Vasily Kuznetsov
2018/10/19 12:47:28
Yay, docstrings!
| |
| 106 | 107 |
| 107 class CreationArgsNamespace: | 108 class CreationArgsNamespace: |
| 108 def __init__(self): | 109 """Mock arguments for creating a new XTM project.""" |
|
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.
| |
| 109 pass | |
| 110 | 110 |
| 111 name = 'bar' | 111 name = 'bar' |
| 112 desc = 'foo' | 112 desc = 'foo' |
| 113 client_id = 10 | 113 client_id = 10 |
| 114 ref_id = 'faz' | 114 ref_id = 'faz' |
| 115 workflow_id = 20 | 115 workflow_id = 20 |
| 116 save_id = False | 116 save_id = False |
| 117 source_dir = None | 117 source_dir = None |
| 118 projects_func = staticmethod(create_project) | 118 projects_func = staticmethod(create_project) |
| 119 source_lang = 'en_US' | 119 source_lang = 'en_US' |
| 120 workflow_name = None | 120 workflow_name = None |
| 121 | 121 |
| 122 class UploadArgsNamespace: | 122 class UploadArgsNamespace: |
| 123 def __init__(self): | 123 """Mock arguments for uploading files to XTM for translation.""" |
| 124 pass | |
| 125 | 124 |
| 126 source_dir = None | 125 source_dir = None |
| 127 projects_func = staticmethod(upload_files) | 126 projects_func = staticmethod(upload_files) |
| 128 no_overwrite = False | 127 no_overwrite = False |
| 129 | 128 |
| 130 class DownloadArgsNamespace: | 129 class DownloadArgsNamespace: |
| 131 def __init__(self): | 130 """Mock arguments for downloading translation from XTM.""" |
| 132 pass | |
| 133 | 131 |
| 134 source_dir = None | 132 source_dir = None |
| 135 projects_func = staticmethod(download_files) | 133 projects_func = staticmethod(download_files) |
| LEFT | RIGHT |