55from fastapi .testclient import TestClient
66from model_engine_server .common .dtos .model_endpoints import GetModelEndpointV1Response
77from model_engine_server .domain .entities import ModelBundle , ModelEndpoint , ModelEndpointStatus
8+ from model_engine_server .domain .use_cases .model_endpoint_use_cases import DEFAULT_DISALLOWED_TEAMS
89
910
1011def test_create_model_endpoint_success (
@@ -40,7 +41,6 @@ def test_create_model_endpoint_success(
4041 assert response_2 .status_code == 200
4142
4243
43- @pytest .mark .skip (reason = "TODO: team validation is currently disabled" )
4444def test_create_model_endpoint_invalid_team_returns_400 (
4545 model_bundle_1_v1 : Tuple [ModelBundle , Any ],
4646 create_model_endpoint_request_sync : Dict [str , Any ],
@@ -59,15 +59,16 @@ def test_create_model_endpoint_invalid_team_returns_400(
5959 fake_batch_job_progress_gateway_contents = {},
6060 fake_docker_image_batch_job_bundle_repository_contents = {},
6161 )
62- create_model_endpoint_request_sync ["labels" ]["team" ] = "some_invalid_team"
62+ invalid_team_name = DEFAULT_DISALLOWED_TEAMS [0 ]
63+ create_model_endpoint_request_sync ["labels" ]["team" ] = invalid_team_name
6364 response_1 = client .post (
6465 "/v1/model-endpoints" ,
6566 auth = (test_api_key , "" ),
6667 json = create_model_endpoint_request_sync ,
6768 )
6869 assert response_1 .status_code == 400
6970
70- create_model_endpoint_request_async ["labels" ]["team" ] = "some_invalid_team"
71+ create_model_endpoint_request_async ["labels" ]["team" ] = invalid_team_name
7172 response_2 = client .post (
7273 "/v1/model-endpoints" ,
7374 auth = (test_api_key , "" ),
@@ -394,7 +395,6 @@ def test_update_model_endpoint_by_id_success(
394395 assert response .json ()["endpoint_creation_task_id" ]
395396
396397
397- @pytest .mark .skip (reason = "TODO: team validation is currently disabled" )
398398def test_update_model_endpoint_by_id_invalid_team_returns_400 (
399399 model_bundle_1_v1 : Tuple [ModelBundle , Any ],
400400 model_endpoint_1 : Tuple [ModelEndpoint , Any ],
@@ -418,8 +418,9 @@ def test_update_model_endpoint_by_id_invalid_team_returns_400(
418418 fake_batch_job_progress_gateway_contents = {},
419419 fake_docker_image_batch_job_bundle_repository_contents = {},
420420 )
421+ invalid_team_name = DEFAULT_DISALLOWED_TEAMS [0 ]
421422 update_model_endpoint_request ["labels" ] = {
422- "team" : "some_invalid_team" ,
423+ "team" : invalid_team_name ,
423424 "product" : "my_product" ,
424425 }
425426 response = client .put (
0 commit comments