File tree Expand file tree Collapse file tree 4 files changed +39
-0
lines changed Expand file tree Collapse file tree 4 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,9 @@ def get(self, name: str) -> Database:
4747 """Get a Database from Firebolt by its name."""
4848 return Database ._from_dict (self ._get_dict (name ), self )
4949
50+ def get_by_name (self , name : str ) -> Database :
51+ return self .get (name )
52+
5053 def get_many (
5154 self ,
5255 name_contains : Optional [str ] = None ,
Original file line number Diff line number Diff line change @@ -55,6 +55,9 @@ def get(self, name: str) -> Engine:
5555 """Get an engine from Firebolt by its name."""
5656 return Engine ._from_dict (self ._get_dict (name ), self )
5757
58+ def get_by_name (self , name : str ) -> Engine :
59+ return self .get (name )
60+
5861 def get_many (
5962 self ,
6063 name_contains : Optional [str ] = None ,
Original file line number Diff line number Diff line change @@ -35,6 +35,22 @@ def test_database_create(
3535 assert database == mock_database
3636
3737
38+ def test_database_get_by_name (
39+ httpx_mock : HTTPXMock ,
40+ resource_manager : ResourceManager ,
41+ database_get_callback : Callable ,
42+ system_engine_no_db_query_url : str ,
43+ mock_database : Database ,
44+ ):
45+ httpx_mock .add_callback (
46+ database_get_callback , url = system_engine_no_db_query_url , method = "POST"
47+ )
48+
49+ database = resource_manager .databases .get_by_name (mock_database .name )
50+
51+ assert database == mock_database
52+
53+
3854def test_database_get (
3955 httpx_mock : HTTPXMock ,
4056 resource_manager : ResourceManager ,
Original file line number Diff line number Diff line change @@ -178,3 +178,20 @@ def test_engine_update_auto_stop_zero(
178178 mock_engine .update (auto_stop = 0 )
179179
180180 assert mock_engine .auto_stop == updated_auto_stop
181+
182+
183+ def test_engine_get_by_name (
184+ httpx_mock : HTTPXMock ,
185+ resource_manager : ResourceManager ,
186+ instance_type_callback : Callable ,
187+ instance_type_url : str ,
188+ get_engine_callback : Callable ,
189+ system_engine_no_db_query_url : str ,
190+ mock_engine : Engine ,
191+ ):
192+ httpx_mock .add_callback (instance_type_callback , url = instance_type_url )
193+ httpx_mock .add_callback (get_engine_callback , url = system_engine_no_db_query_url )
194+
195+ engine = resource_manager .engines .get_by_name (mock_engine .name )
196+
197+ assert engine == mock_engine
You can’t perform that action at this time.
0 commit comments