@@ -44,19 +44,19 @@ def test_create_datasources(self, mock_del, mock_post, mock_put, mock_get):
4444 response_mock (mock_get , example_ds .model_dump ())
4545
4646 ds = client .datasources .create (example_ds )
47- def check_ds_created (ds , mock_post ):
47+ def check_ds_created (ds , mock_post , url ):
4848 self ._compare_ds (ds , example_ds )
4949 args , kwargs = mock_post .call_args
5050
5151 assert kwargs ['headers' ] == {'Authorization' : 'Bearer ' + API_KEY }
5252 assert kwargs ['json' ] == example_ds .model_dump ()
53- assert args [0 ] == 'https://mdb.ai/api/datasources'
53+ assert args [0 ] == url
5454
55- check_ds_created (ds , mock_post )
55+ check_ds_created (ds , mock_post , 'https://mdb.ai/api/datasources' )
5656
5757 # with update
5858 ds = client .datasources .create (example_ds , update = True )
59- check_ds_created (ds , mock_put )
59+ check_ds_created (ds , mock_put , f'https://mdb.ai/api/datasources/ { ds . name } ' )
6060
6161 @patch ('requests.get' )
6262 def test_get_datasource (self , mock_get ):
@@ -132,17 +132,17 @@ def test_create(self, mock_del, mock_post, mock_put, mock_get):
132132 }
133133 mind = client .minds .create (** create_params )
134134
135- def check_mind_created (mind , mock_post , create_params ):
135+ def check_mind_created (mind , mock_post , create_params , url ):
136136 args , kwargs = mock_post .call_args
137- assert args [0 ].endswith ('/api/projects/mindsdb/minds' )
137+ assert args [0 ].endswith (url )
138138 request = kwargs ['json' ]
139139 for key in ('name' , 'datasources' , 'provider' , 'model_name' ),:
140140 assert request .get (key ) == create_params .get (key )
141141 assert create_params .get ('prompt_template' ) == request .get ('parameters' , {}).get ('prompt_template' )
142142
143143 self .compare_mind (mind , self .mind_json )
144144
145- check_mind_created (mind , mock_post , create_params )
145+ check_mind_created (mind , mock_post , create_params , '/api/projects/mindsdb/minds' )
146146
147147 # -- with replace --
148148 create_params = {
@@ -156,15 +156,15 @@ def check_mind_created(mind, mock_post, create_params):
156156 args , _ = mock_del .call_args
157157 assert args [0 ].endswith (f'/api/projects/mindsdb/minds/{ mind_name } ' )
158158
159- check_mind_created (mind , mock_post , create_params )
159+ check_mind_created (mind , mock_post , create_params , '/api/projects/mindsdb/minds' )
160160
161161 # -- with update --
162162 mock_del .reset_mock ()
163163 mind = client .minds .create (update = True , ** create_params )
164164 # is not deleted
165165 assert not mock_del .called
166166
167- check_mind_created (mind , mock_put , create_params )
167+ check_mind_created (mind , mock_put , create_params , f'/api/projects/mindsdb/minds/ { mind_name } ' )
168168
169169 @patch ('requests.get' )
170170 @patch ('requests.patch' )
0 commit comments