(mock_plugins, mock_config, mock_datasource)
| 118 | @mock.patch("importer.all.import_default_config_from_env", return_value=None) |
| 119 | @pytest.mark.asyncio |
| 120 | async def test_import_datasources_from_env(mock_plugins, mock_config, mock_datasource): |
| 121 | os.environ[ |
| 122 | "IQENGINE_CONNECTION_INFO" |
| 123 | ] = """ |
| 124 | { |
| 125 | "settings": |
| 126 | [ |
| 127 | { |
| 128 | "accountName": "test_account", |
| 129 | "containerName": "test_container", |
| 130 | "sasToken": "test_sas_token", |
| 131 | "name": "test_name", |
| 132 | "description": "test_description", |
| 133 | "imageURL": "test_image_url", |
| 134 | "accountKey": "test_account_key" |
| 135 | } |
| 136 | ] |
| 137 | } |
| 138 | """ |
| 139 | |
| 140 | mock_datasource.datasource_exists = AsyncMock() |
| 141 | mock_datasource.datasource_exists.return_value = False |
| 142 | mock_datasource.create = AsyncMock() |
| 143 | mock_datasource.create.return_value = None |
| 144 | |
| 145 | await import_all_from_env() |
| 146 | |
| 147 | mock_datasource.datasource_exists.assert_called_once() |
| 148 | mock_datasource.create.assert_called_once() |
nothing calls this directly
no test coverage detected