MCPcopy Create free account
hub / github.com/IQEngine/IQEngine / test_import_plugins_from_env

Function test_import_plugins_from_env

api/tests/test_importer.py:14–28  ·  view source on GitHub ↗
(mock_datasources, mock_plugins, mock_collection)

Source from the content-addressed store, hash-verified

12@mock.patch("importer.all.import_datasources_from_env", return_value=None)
13@pytest.mark.asyncio
14async def test_import_plugins_from_env(mock_datasources, mock_plugins, mock_collection):
15 os.environ[
16 "IQENGINE_PLUGINS"
17 ] = '[{"name": "test_plugin", "url": "http://test_plugin"}]'
18 os.environ["IQENGINE_FEATURE_FLAGS"] = '{"test": true}'
19
20 mock_collection.return_value.find_one = AsyncMock()
21 mock_collection.return_value.find_one.return_value = None
22 mock_collection.return_value.insert_one = AsyncMock()
23
24 await import_all_from_env()
25
26 mock_collection.return_value.insert_one.assert_called_once()
27 mock_collection.return_value.find_one.assert_called_once()
28 mock.patch.stopall()
29
30
31@mock.patch("importer.config.collection", return_value=Mock())

Callers

nothing calls this directly

Calls 1

import_all_from_envFunction · 0.90

Tested by

no test coverage detected