@@ -24,7 +24,6 @@ def test_engine_start_stop(
2424 httpx_mock .add_callback (auth_callback , url = auth_url )
2525 httpx_mock .add_callback (provider_callback , url = provider_url )
2626 httpx_mock .add_callback (account_id_callback , url = account_id_url )
27- httpx_mock .add_callback (auth_callback , url = auth_url )
2827
2928 httpx_mock .add_callback (engine_callback , url = f"{ account_engine_url } " , method = "GET" )
3029 httpx_mock .add_callback (
@@ -44,3 +43,58 @@ def test_engine_start_stop(
4443 engine = mock_engine .stop (wait_for_stop = False )
4544
4645 assert engine .name == mock_engine .name
46+
47+
48+ def test_engine_get_many (
49+ httpx_mock : HTTPXMock ,
50+ settings : Settings ,
51+ mock_engine : Engine ,
52+ auth_callback : Callable ,
53+ auth_url : str ,
54+ engine_url : str ,
55+ many_engines_callback : Callable ,
56+ provider_callback : Callable ,
57+ provider_url : str ,
58+ account_id_callback : Callable ,
59+ account_id_url : Pattern ,
60+ ):
61+
62+ httpx_mock .add_callback (auth_callback , url = auth_url )
63+ httpx_mock .add_callback (provider_callback , url = provider_url )
64+ httpx_mock .add_callback (account_id_callback , url = account_id_url )
65+ filters = "?page.first=5000&filter.name_contains=test"
66+ httpx_mock .add_callback (many_engines_callback , url = engine_url + filters )
67+
68+ manager = ResourceManager (settings = settings )
69+ engines = manager .engines .get_many (name_contains = "test" )
70+ assert len (engines ) == 1
71+ assert engines [0 ].name == mock_engine .name
72+
73+
74+ def test_engine_get_many_with_region (
75+ httpx_mock : HTTPXMock ,
76+ settings : Settings ,
77+ mock_engine : Engine ,
78+ auth_callback : Callable ,
79+ auth_url : str ,
80+ engine_url : str ,
81+ many_engines_callback : Callable ,
82+ provider_callback : Callable ,
83+ provider_url : str ,
84+ account_id_callback : Callable ,
85+ account_id_url : Pattern ,
86+ region_callback : Callable ,
87+ region_url : str ,
88+ ):
89+
90+ httpx_mock .add_callback (auth_callback , url = auth_url )
91+ httpx_mock .add_callback (provider_callback , url = provider_url )
92+ httpx_mock .add_callback (account_id_callback , url = account_id_url )
93+ httpx_mock .add_callback (region_callback , url = region_url )
94+ filters = "?page.first=5000&filter.name_contains=test&filter.compute_region_id_region_id_eq=mock_region_id_1"
95+ httpx_mock .add_callback (many_engines_callback , url = engine_url + filters )
96+
97+ manager = ResourceManager (settings = settings )
98+ engines = manager .engines .get_many (name_contains = "test" , region_eq = "mock_region_1" )
99+ assert len (engines ) == 1
100+ assert engines [0 ].name == mock_engine .name
0 commit comments