99import pytest
1010from click .testing import CliRunner
1111from lightning_cloud .openapi import (
12- V1LightningappV2 ,
12+ V1CloudSpace ,
13+ V1ListCloudSpacesResponse ,
1314 V1ListLightningappInstancesResponse ,
14- V1ListLightningappsV2Response ,
1515 V1ListMembershipsResponse ,
1616 V1Membership ,
1717)
@@ -37,8 +37,8 @@ class FakeResponse:
3737
3838
3939class FakeLightningClient :
40- def lightningapp_v2_service_list_lightningapps_v2 (self , * args , ** kwargs ):
41- return V1ListLightningappsV2Response ( lightningapps = [])
40+ def cloud_space_service_list_cloud_spaces (self , * args , ** kwargs ):
41+ return V1ListCloudSpacesResponse ( cloudspaces = [])
4242
4343 def lightningapp_instance_service_list_lightningapp_instances (self , * args , ** kwargs ):
4444 return V1ListLightningappInstancesResponse (lightningapps = [])
@@ -105,14 +105,14 @@ def __init__(self, *args, create_response, **kwargs):
105105 super ().__init__ ()
106106 self .create_response = create_response
107107
108- def lightningapp_v2_service_create_lightningapp_v2 (self , * args , ** kwargs ):
109- return V1LightningappV2 (id = "my_app" , name = "app" )
108+ def cloud_space_service_create_cloud_space (self , * args , ** kwargs ):
109+ return V1CloudSpace (id = "my_app" , name = "app" )
110110
111- def lightningapp_v2_service_create_lightningapp_release (self , project_id , app_id , body ):
111+ def cloud_space_service_create_lightning_run (self , project_id , cloudspace_id , body ):
112112 assert project_id == "test-project-id"
113113 return self .create_response
114114
115- def lightningapp_v2_service_create_lightningapp_release_instance (self , project_id , app_id , id , body ):
115+ def cloud_space_service_create_lightning_run_instance (self , project_id , cloudspace_id , id , body ):
116116 assert project_id == "test-project-id"
117117 return self .create_response
118118
@@ -123,7 +123,7 @@ def lightningapp_v2_service_create_lightningapp_release_instance(self, project_i
123123def test_start_app (create_response , monkeypatch ):
124124
125125 monkeypatch .setattr (cloud , "V1LightningappInstanceState" , MagicMock ())
126- monkeypatch .setattr (cloud , "Body8 " , MagicMock ())
126+ monkeypatch .setattr (cloud , "CloudspaceIdRunsBody " , MagicMock ())
127127 monkeypatch .setattr (cloud , "V1Flowserver" , MagicMock ())
128128 monkeypatch .setattr (cloud , "V1LightningappInstanceSpec" , MagicMock ())
129129 monkeypatch .setattr (
@@ -167,7 +167,7 @@ def run():
167167 flow_servers = ANY ,
168168 )
169169
170- cloud .Body8 .assert_called_once ()
170+ cloud .CloudspaceIdRunsBody .assert_called_once ()
171171
172172
173173class HttpHeaderDict (dict ):
@@ -186,7 +186,7 @@ def __init__(self, *args, message, **kwargs):
186186 super ().__init__ ()
187187 self .message = message
188188
189- def lightningapp_v2_service_list_lightningapps_v2 (self , * args , ** kwargs ):
189+ def cloud_space_service_list_cloud_spaces (self , * args , ** kwargs ):
190190 raise ApiException (
191191 http_resp = HttpHeaderDict (
192192 data = self .message ,
@@ -207,7 +207,7 @@ def lightningapp_v2_service_list_lightningapps_v2(self, *args, **kwargs):
207207def test_start_app_exception (message , monkeypatch , caplog ):
208208
209209 monkeypatch .setattr (cloud , "V1LightningappInstanceState" , MagicMock ())
210- monkeypatch .setattr (cloud , "Body8 " , MagicMock ())
210+ monkeypatch .setattr (cloud , "CloudspaceIdRunsBody " , MagicMock ())
211211 monkeypatch .setattr (cloud , "V1Flowserver" , MagicMock ())
212212 monkeypatch .setattr (cloud , "V1LightningappInstanceSpec" , MagicMock ())
213213 monkeypatch .setattr (cloud , "LocalSourceCodeDir" , MagicMock ())
0 commit comments