@@ -1095,7 +1095,7 @@ def test_list(self, mock_get):
10951095 ])
10961096 all_agents = server .agents .list ()
10971097 # Check API call.
1098- assert mock_get .call_args . args [0 ] == f'{ DEFAULT_LOCAL_API_URL } /api/projects/mindsdb/agents'
1098+ assert mock_get .call_args [ 0 ] [0 ] == f'{ DEFAULT_LOCAL_API_URL } /api/projects/mindsdb/agents'
10991099
11001100 assert len (all_agents ) == 1
11011101 expected_agent = Agent (
@@ -1127,7 +1127,7 @@ def test_get(self, mock_get):
11271127 )
11281128 agent = server .agents .get ('test_agent' )
11291129 # Check API call.
1130- assert mock_get .call_args . args [0 ] == f'{ DEFAULT_LOCAL_API_URL } /api/projects/mindsdb/agents/test_agent'
1130+ assert mock_get .call_args [ 0 ] [0 ] == f'{ DEFAULT_LOCAL_API_URL } /api/projects/mindsdb/agents/test_agent'
11311131 expected_agent = Agent (
11321132 'test_agent' ,
11331133 'test_model' ,
@@ -1170,8 +1170,8 @@ def test_create(self, mock_post):
11701170 )
11711171 # Check API call.
11721172 assert len (mock_post .call_args_list ) == 2
1173- assert mock_post .call_args . args [0 ] == f'{ DEFAULT_LOCAL_API_URL } /api/projects/mindsdb/agents'
1174- assert mock_post .call_args . kwargs ['json' ] == {
1173+ assert mock_post .call_args [ 0 ] [0 ] == f'{ DEFAULT_LOCAL_API_URL } /api/projects/mindsdb/agents'
1174+ assert mock_post .call_args [ 1 ] ['json' ] == {
11751175 'agent' : {
11761176 'name' : 'test_agent' ,
11771177 'model_name' :'m1' ,
@@ -1181,8 +1181,8 @@ def test_create(self, mock_post):
11811181 }
11821182
11831183 # Skill should have been created too.
1184- assert mock_post .call_args_list [- 2 ]. args [0 ] == f'{ DEFAULT_LOCAL_API_URL } /api/projects/mindsdb/skills'
1185- assert mock_post .call_args_list [- 2 ]. kwargs ['json' ] == {
1184+ assert mock_post .call_args_list [- 2 ][ 0 ] [0 ] == f'{ DEFAULT_LOCAL_API_URL } /api/projects/mindsdb/skills'
1185+ assert mock_post .call_args_list [- 2 ][ 1 ] ['json' ] == {
11861186 'skill' : {
11871187 'name' : 'test_skill' ,
11881188 'type' : 'sql' ,
@@ -1250,8 +1250,8 @@ def test_update(self, mock_get, mock_put, _):
12501250
12511251 updated_agent = server .agents .update ('test_agent' , expected_agent )
12521252 # Check API calls.
1253- assert mock_put .call_args . args [0 ] == f'{ DEFAULT_LOCAL_API_URL } /api/projects/mindsdb/agents/test_agent'
1254- assert mock_put .call_args . kwargs ['json' ] == {
1253+ assert mock_put .call_args [ 0 ] [0 ] == f'{ DEFAULT_LOCAL_API_URL } /api/projects/mindsdb/agents/test_agent'
1254+ assert mock_put .call_args [ 1 ] ['json' ] == {
12551255 'agent' : {
12561256 'name' : 'test_agent' ,
12571257 'model_name' : 'updated_model' ,
@@ -1280,8 +1280,8 @@ def test_completion(self, mock_post):
12801280 }]
12811281 completion = server .agents .completion ('test_agent' , messages )
12821282 # Check API call.
1283- assert mock_post .call_args . args [0 ] == f'{ DEFAULT_LOCAL_API_URL } /api/projects/mindsdb/agents/test_agent/completions'
1284- assert mock_post .call_args . kwargs ['json' ] == {
1283+ assert mock_post .call_args [ 0 ] [0 ] == f'{ DEFAULT_LOCAL_API_URL } /api/projects/mindsdb/agents/test_agent/completions'
1284+ assert mock_post .call_args [ 1 ] ['json' ] == {
12851285 'messages' : messages
12861286 }
12871287 assert completion .content == 'Angel Falls in Venezuela at 979m'
@@ -1291,7 +1291,7 @@ def test_delete(self, mock_delete):
12911291 server = mindsdb_sdk .connect ()
12921292 server .agents .drop ('test_agent' )
12931293 # Check API call.
1294- assert mock_delete .call_args . args [0 ] == f'{ DEFAULT_LOCAL_API_URL } /api/projects/mindsdb/agents/test_agent'
1294+ assert mock_delete .call_args [ 0 ] [0 ] == f'{ DEFAULT_LOCAL_API_URL } /api/projects/mindsdb/agents/test_agent'
12951295
12961296
12971297class TestSkills ():
@@ -1301,7 +1301,7 @@ def test_list(self, mock_get):
13011301 server = mindsdb_sdk .connect ()
13021302 # Check API call.
13031303 assert len (server .skills .list ()) == 0
1304- assert mock_get .call_args . args [0 ] == f'{ DEFAULT_LOCAL_API_URL } /api/projects/mindsdb/skills'
1304+ assert mock_get .call_args [ 0 ] [0 ] == f'{ DEFAULT_LOCAL_API_URL } /api/projects/mindsdb/skills'
13051305
13061306 created_at = dt .datetime (2000 , 3 , 1 , 9 , 30 )
13071307 updated_at = dt .datetime (2001 , 3 , 1 , 9 , 30 )
@@ -1334,7 +1334,7 @@ def test_get(self, mock_get):
13341334 )
13351335 skill = server .skills .get ('test_skill' )
13361336 # Check API call.
1337- assert mock_get .call_args . args [0 ] == f'{ DEFAULT_LOCAL_API_URL } /api/projects/mindsdb/skills/test_skill'
1337+ assert mock_get .call_args [ 0 ] [0 ] == f'{ DEFAULT_LOCAL_API_URL } /api/projects/mindsdb/skills/test_skill'
13381338 expected_skill = SQLSkill ('test_skill' , ['test_table' ], 'test_database' )
13391339 assert skill == expected_skill
13401340
@@ -1357,8 +1357,8 @@ def test_create(self, mock_post):
13571357 params = {'tables' : ['test_table' ], 'database' : 'test_database' }
13581358 )
13591359 # Check API call.
1360- assert mock_post .call_args . args [0 ] == f'{ DEFAULT_LOCAL_API_URL } /api/projects/mindsdb/skills'
1361- assert mock_post .call_args . kwargs ['json' ] == {
1360+ assert mock_post .call_args [ 0 ] [0 ] == f'{ DEFAULT_LOCAL_API_URL } /api/projects/mindsdb/skills'
1361+ assert mock_post .call_args [ 1 ] ['json' ] == {
13621362 'skill' : {
13631363 'name' : 'test_skill' ,
13641364 'type' : 'sql' ,
@@ -1385,8 +1385,8 @@ def test_update(self, mock_put):
13851385
13861386 updated_skill = server .skills .update ('test_skill' , expected_skill )
13871387 # Check API call.
1388- assert mock_put .call_args . args [0 ] == f'{ DEFAULT_LOCAL_API_URL } /api/projects/mindsdb/skills/test_skill'
1389- assert mock_put .call_args . kwargs ['json' ] == {
1388+ assert mock_put .call_args [ 0 ] [0 ] == f'{ DEFAULT_LOCAL_API_URL } /api/projects/mindsdb/skills/test_skill'
1389+ assert mock_put .call_args [ 1 ] ['json' ] == {
13901390 'skill' : {
13911391 'name' : 'test_skill' ,
13921392 'type' : 'sql' ,
@@ -1401,4 +1401,4 @@ def test_delete(self, mock_delete):
14011401 server = mindsdb_sdk .connect ()
14021402 server .skills .drop ('test_skill' )
14031403 # Check API call.
1404- assert mock_delete .call_args . args [0 ] == f'{ DEFAULT_LOCAL_API_URL } /api/projects/mindsdb/skills/test_skill'
1404+ assert mock_delete .call_args [ 0 ] [0 ] == f'{ DEFAULT_LOCAL_API_URL } /api/projects/mindsdb/skills/test_skill'
0 commit comments