Fix tests

This commit is contained in:
Tim Bentley 2018-12-11 19:45:27 +00:00
parent 47236b0238
commit dbd3d8f0ef
2 changed files with 6 additions and 4 deletions

View File

@ -421,9 +421,11 @@ class TestPluginManager(TestCase):
mocked_plugin = MagicMock() mocked_plugin = MagicMock()
mocked_plugin.name = 'Mocked Plugin' mocked_plugin.name = 'Mocked Plugin'
plugin_manager = PluginManager() plugin_manager = PluginManager()
plugin_manager.plugins = [mocked_plugin] Registry().register('mock_plugin', mocked_plugin)
# WHEN: We run finalise_plugins() # WHEN: We run finalise_plugins()
State().add_service("mock", 1, is_plugin=True, status=PluginStatus.Active)
State().flush_preconditions()
result = plugin_manager.get_plugin_by_name('Mocked Plugin') result = plugin_manager.get_plugin_by_name('Mocked Plugin')
# THEN: The is_active() and finalise() methods should have been called # THEN: The is_active() and finalise() methods should have been called

View File

@ -123,11 +123,11 @@ class TestState(TestCase, TestMixin):
# THEN correct the state when I flush the preconditions # THEN correct the state when I flush the preconditions
assert State().modules['test'].pass_preconditions is False assert State().modules['test'].pass_preconditions is False
assert State().modules['test2'].pass_preconditions is True assert State().modules['test2'].pass_preconditions is False
assert State().modules['test1'].pass_preconditions is True assert State().modules['test1'].pass_preconditions is False
State().flush_preconditions() State().flush_preconditions()
assert State().modules['test'].pass_preconditions is False assert State().modules['test'].pass_preconditions is False
assert State().modules['test2'].pass_preconditions is True assert State().modules['test2'].pass_preconditions is False
assert State().modules['test1'].pass_preconditions is False assert State().modules['test1'].pass_preconditions is False
def test_basic_preconditions_pass(self): def test_basic_preconditions_pass(self):