|
@@ 184-201 (lines=18) @@
|
| 181 |
|
|
| 182 |
|
assert status == False, status |
| 183 |
|
|
| 184 |
|
@mock.patch('elodie.config.config_file', '%s/config.ini-throw-runtime-error' % gettempdir()) |
| 185 |
|
def test_throw_error_runtime_error(): |
| 186 |
|
with open('%s/config.ini-throw-runtime-error' % gettempdir(), 'w') as f: |
| 187 |
|
f.write(""" |
| 188 |
|
[Plugins] |
| 189 |
|
plugins=RuntimeError |
| 190 |
|
""") |
| 191 |
|
if hasattr(load_config, 'config'): |
| 192 |
|
del load_config.config |
| 193 |
|
|
| 194 |
|
plugins = Plugins() |
| 195 |
|
plugins.load() |
| 196 |
|
status = plugins.run_all_before('', '') |
| 197 |
|
|
| 198 |
|
if hasattr(load_config, 'config'): |
| 199 |
|
del load_config.config |
| 200 |
|
|
| 201 |
|
assert status == True, status |
| 202 |
|
|
| 203 |
|
def test_plugin_base_inherits_db(): |
| 204 |
|
plugin_base = PluginBase() |
|
@@ 165-182 (lines=18) @@
|
| 162 |
|
|
| 163 |
|
assert status == False, status |
| 164 |
|
|
| 165 |
|
@mock.patch('elodie.config.config_file', '%s/config.ini-throw-error-one-of-many' % gettempdir()) |
| 166 |
|
def test_throw_error_one_of_many(): |
| 167 |
|
with open('%s/config.ini-throw-error-one-of-many' % gettempdir(), 'w') as f: |
| 168 |
|
f.write(""" |
| 169 |
|
[Plugins] |
| 170 |
|
plugins=Dummy,ThrowError |
| 171 |
|
""") |
| 172 |
|
if hasattr(load_config, 'config'): |
| 173 |
|
del load_config.config |
| 174 |
|
|
| 175 |
|
plugins = Plugins() |
| 176 |
|
plugins.load() |
| 177 |
|
status = plugins.run_all_before('', '') |
| 178 |
|
|
| 179 |
|
if hasattr(load_config, 'config'): |
| 180 |
|
del load_config.config |
| 181 |
|
|
| 182 |
|
assert status == False, status |
| 183 |
|
|
| 184 |
|
@mock.patch('elodie.config.config_file', '%s/config.ini-throw-runtime-error' % gettempdir()) |
| 185 |
|
def test_throw_error_runtime_error(): |
|
@@ 146-163 (lines=18) @@
|
| 143 |
|
assert before_ran_1 == False, before_ran_1 |
| 144 |
|
assert before_ran_2 == True, before_ran_2 |
| 145 |
|
|
| 146 |
|
@mock.patch('elodie.config.config_file', '%s/config.ini-throw-error' % gettempdir()) |
| 147 |
|
def test_throw_error(): |
| 148 |
|
with open('%s/config.ini-throw-error' % gettempdir(), 'w') as f: |
| 149 |
|
f.write(""" |
| 150 |
|
[Plugins] |
| 151 |
|
plugins=ThrowError |
| 152 |
|
""") |
| 153 |
|
if hasattr(load_config, 'config'): |
| 154 |
|
del load_config.config |
| 155 |
|
|
| 156 |
|
plugins = Plugins() |
| 157 |
|
plugins.load() |
| 158 |
|
status = plugins.run_all_before('', '') |
| 159 |
|
|
| 160 |
|
if hasattr(load_config, 'config'): |
| 161 |
|
del load_config.config |
| 162 |
|
|
| 163 |
|
assert status == False, status |
| 164 |
|
|
| 165 |
|
@mock.patch('elodie.config.config_file', '%s/config.ini-throw-error-one-of-many' % gettempdir()) |
| 166 |
|
def test_throw_error_one_of_many(): |