(mock_datasources, mock_plugins, mock_collection)
| 12 | @mock.patch("importer.all.import_datasources_from_env", return_value=None) |
| 13 | @pytest.mark.asyncio |
| 14 | async 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()) |
nothing calls this directly
no test coverage detected