@@ -160,7 +160,7 @@ def test_get_plans(runner: CliRunner):
160160
161161 response = responses .add (
162162 responses .GET ,
163- "http://localhost:8000/plans" ,
163+ "http://localhost:8000/api/v1/ plans" ,
164164 json = PlanResponse (plans = [PlanModel .from_plan (plan )]).model_dump (),
165165 status = 200 ,
166166 )
@@ -176,7 +176,7 @@ def test_get_devices(runner: CliRunner):
176176
177177 response = responses .add (
178178 responses .GET ,
179- "http://localhost:8000/devices" ,
179+ "http://localhost:8000/api/v1/ devices" ,
180180 json = DeviceResponse (devices = [DeviceModel .from_device (device )]).model_dump (),
181181 status = 200 ,
182182 )
@@ -218,7 +218,7 @@ def test_submit_plan(runner: CliRunner):
218218 }
219219
220220 response = responses .post (
221- url = "http://a.fake.host:12345/tasks" ,
221+ url = "http://a.fake.host:12345/api/v1/ tasks" ,
222222 match = [matchers .json_params_matcher (body_data )],
223223 )
224224
@@ -268,7 +268,7 @@ def test_submit_plan_without_stomp(runner: CliRunner):
268268def test_run_plan (stomp_client : StompClient , runner : CliRunner ):
269269 task_id = "abcd-1234"
270270 submit_response = responses .post (
271- url = "http://a.fake.host:12345/tasks" ,
271+ url = "http://a.fake.host:12345/api/v1/ tasks" ,
272272 match = [
273273 matchers .json_params_matcher (
274274 {
@@ -282,7 +282,7 @@ def test_run_plan(stomp_client: StompClient, runner: CliRunner):
282282 status = 201 ,
283283 )
284284 run_response = responses .put (
285- url = "http://a.fake.host:12345/worker/task" ,
285+ url = "http://a.fake.host:12345/api/v1/ worker/task" ,
286286 match = [matchers .json_params_matcher ({"task_id" : task_id })],
287287 json = {"task_id" : task_id },
288288 )
@@ -398,7 +398,7 @@ def test_run_plan_feedback(
398398@responses .activate
399399def test_run_plan_background_without_stomp (runner : CliRunner ):
400400 submit_response = responses .post (
401- url = "http://a.fake.host:12345/tasks" ,
401+ url = "http://a.fake.host:12345/api/v1/ tasks" ,
402402 match = [
403403 matchers .json_params_matcher (
404404 {
@@ -412,7 +412,7 @@ def test_run_plan_background_without_stomp(runner: CliRunner):
412412 status = 201 ,
413413 )
414414 run_response = responses .put (
415- url = "http://a.fake.host:12345/worker/task" ,
415+ url = "http://a.fake.host:12345/api/v1/ worker/task" ,
416416 match = [matchers .json_params_matcher ({"task_id" : "abcd-1234" })],
417417 json = {"task_id" : "abcd-1234" },
418418 )
@@ -541,7 +541,7 @@ def test_get_env(runner: CliRunner):
541541 environment_id = uuid .uuid4 ()
542542 responses .add (
543543 responses .GET ,
544- "http://localhost:8000/environment" ,
544+ "http://localhost:8000/api/v1/ environment" ,
545545 json = EnvironmentResponse (
546546 environment_id = environment_id , initialized = True
547547 ).model_dump (mode = "json" ),
@@ -559,7 +559,10 @@ def test_get_env(runner: CliRunner):
559559@responses .activate
560560def test_get_state (runner : CliRunner ):
561561 responses .add (
562- responses .GET , "http://localhost:8000/worker/state" , json = "IDLE" , status = 200
562+ responses .GET ,
563+ "http://localhost:8000/api/v1/worker/state" ,
564+ json = "IDLE" ,
565+ status = 200 ,
563566 )
564567 state = runner .invoke (main , ["controller" , "state" ])
565568 print (state .stderr )
@@ -576,7 +579,7 @@ def test_reset_env_client_behavior(
576579 environment_id = uuid .uuid4 ()
577580 responses .add (
578581 responses .DELETE ,
579- "http://localhost:8000/environment" ,
582+ "http://localhost:8000/api/v1/ environment" ,
580583 json = EnvironmentResponse (
581584 environment_id = environment_id , initialized = False
582585 ).model_dump (mode = "json" ),
@@ -588,7 +591,7 @@ def test_reset_env_client_behavior(
588591 for state in env_state :
589592 responses .add (
590593 responses .GET ,
591- "http://localhost:8000/environment" ,
594+ "http://localhost:8000/api/v1/ environment" ,
592595 json = EnvironmentResponse (
593596 environment_id = environment_id , initialized = state
594597 ).model_dump (mode = "json" ),
@@ -604,10 +607,10 @@ def test_reset_env_client_behavior(
604607 for index , call in enumerate (responses .calls ):
605608 if index == 0 :
606609 assert call .request .method == "DELETE"
607- assert call .request .url == "http://localhost:8000/environment"
610+ assert call .request .url == "http://localhost:8000/api/v1/ environment"
608611 else :
609612 assert call .request .method == "GET"
610- assert call .request .url == "http://localhost:8000/environment"
613+ assert call .request .url == "http://localhost:8000/api/v1/ environment"
611614
612615 # Check if the final environment status is printed correctly
613616 # assert "Environment is initialized." in result.output
@@ -625,7 +628,7 @@ def test_env_timeout(mock_sleep: Mock, runner: CliRunner):
625628 environment_id = uuid .uuid4 ()
626629 responses .add (
627630 responses .DELETE ,
628- "http://localhost:8000/environment" ,
631+ "http://localhost:8000/api/v1/ environment" ,
629632 status = 200 ,
630633 json = EnvironmentResponse (
631634 environment_id = environment_id , initialized = False
@@ -634,7 +637,7 @@ def test_env_timeout(mock_sleep: Mock, runner: CliRunner):
634637 # Add responses for each polling attempt, all indicating not initialized
635638 responses .add (
636639 responses .GET ,
637- "http://localhost:8000/environment" ,
640+ "http://localhost:8000/api/v1/ environment" ,
638641 json = EnvironmentResponse (
639642 environment_id = environment_id , initialized = False
640643 ).model_dump (mode = "json" ),
@@ -655,12 +658,12 @@ def test_env_timeout(mock_sleep: Mock, runner: CliRunner):
655658
656659 # First call should be DELETE
657660 assert responses .calls [0 ].request .method == "DELETE"
658- assert responses .calls [0 ].request .url == "http://localhost:8000/environment"
661+ assert responses .calls [0 ].request .url == "http://localhost:8000/api/v1/ environment"
659662
660663 # Remaining calls should all be GET
661664 for call in responses .calls [1 :]: # Skip the first DELETE request # type: ignore
662665 assert call .request .method == "GET"
663- assert call .request .url == "http://localhost:8000/environment"
666+ assert call .request .url == "http://localhost:8000/api/v1/ environment"
664667
665668 # Check the output for the timeout message
666669 assert result .output == "Reloading environment\n "
@@ -673,7 +676,10 @@ def test_env_timeout(mock_sleep: Mock, runner: CliRunner):
673676def test_env_reload_server_side_error (runner : CliRunner ):
674677 # Setup mocked error response from the server
675678 responses .add (
676- responses .DELETE , "http://localhost:8000/environment" , status = 500 , json = {}
679+ responses .DELETE ,
680+ "http://localhost:8000/api/v1/environment" ,
681+ status = 500 ,
682+ json = {},
677683 )
678684
679685 result = runner .invoke (main , ["controller" , "env" , "-r" ])
@@ -687,7 +693,7 @@ def test_env_reload_server_side_error(runner: CliRunner):
687693
688694 # Only call should be DELETE
689695 assert responses .calls [0 ].request .method == "DELETE"
690- assert responses .calls [0 ].request .url == "http://localhost:8000/environment"
696+ assert responses .calls [0 ].request .url == "http://localhost:8000/api/v1/ environment"
691697
692698 # Check the output for the timeout message
693699 # TODO this seems wrong but this is the current behaviour
@@ -1279,7 +1285,7 @@ def test_get_python_environment(runner: CliRunner):
12791285 }
12801286 response = responses .add (
12811287 responses .GET ,
1282- "http://localhost:8000/python_environment" ,
1288+ "http://localhost:8000/api/v1/ python_environment" ,
12831289 json = scratch_config ,
12841290 status = 200 ,
12851291 )
@@ -1302,7 +1308,7 @@ def test_get_python_env_with_empty_response(runner: CliRunner):
13021308 }
13031309 response = responses .add (
13041310 responses .GET ,
1305- "http://localhost:8000/python_environment" ,
1311+ "http://localhost:8000/api/v1/ python_environment" ,
13061312 json = scratch_config ,
13071313 status = 200 ,
13081314 )
0 commit comments