|
1 | 1 | from typing import Callable |
2 | 2 |
|
3 | 3 | from httpx import Request |
4 | | -from pytest import raises |
| 4 | +from pytest import mark, raises |
5 | 5 | from pytest_httpx import HTTPXMock |
6 | 6 |
|
7 | 7 | from firebolt.model.V2.database import Database |
@@ -228,3 +228,28 @@ def test_engine_deleteting( |
228 | 228 | engine = resource_manager.engines.get_by_name(mock_engine.name) |
229 | 229 |
|
230 | 230 | assert engine.current_status == EngineStatus.DELETING |
| 231 | + |
| 232 | + |
| 233 | +@mark.parametrize( |
| 234 | + "engine_status, expected_status", |
| 235 | + [(status.value.upper(), status) for status in EngineStatus], |
| 236 | +) |
| 237 | +def test_engine_new_status( |
| 238 | + engine_status: str, |
| 239 | + expected_status: EngineStatus, |
| 240 | + httpx_mock: HTTPXMock, |
| 241 | + resource_manager: ResourceManager, |
| 242 | + instance_type_callback: Callable, |
| 243 | + instance_type_url: str, |
| 244 | + system_engine_no_db_query_url: str, |
| 245 | + mock_engine: Engine, |
| 246 | +): |
| 247 | + mock_engine.current_status = engine_status |
| 248 | + get_engine_callback = get_objects_from_db_callback([mock_engine]) |
| 249 | + |
| 250 | + httpx_mock.add_callback(instance_type_callback, url=instance_type_url) |
| 251 | + httpx_mock.add_callback(get_engine_callback, url=system_engine_no_db_query_url) |
| 252 | + |
| 253 | + engine = resource_manager.engines.get_by_name(mock_engine.name) |
| 254 | + |
| 255 | + assert engine.current_status == expected_status |
0 commit comments