File tree Expand file tree Collapse file tree
holochain_client/api/admin Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 AppInfo ,
88 AppInterfaceAttached ,
99 AttachAppInterface ,
10+ DisableApp ,
1011 DumpNetworkStats ,
1112 EnableApp ,
1213 GenerateAgentPubKey ,
@@ -118,6 +119,10 @@ async def enable_app(self, request: EnableApp) -> AppEnabled:
118119 assert response ["type" ] == "app_enabled" , f"response was: { response } "
119120 return AppEnabled (* response ["data" ])
120121
122+ async def disable_app (self , request : DisableApp ):
123+ response = await self ._exchange (request , tag_from_type (request ))
124+ assert response ["type" ] == "app_disabled" , f"response was: { response } "
125+
121126 async def attach_app_interface (
122127 self , request : AttachAppInterface = AttachAppInterface ()
123128 ) -> AppInterfaceAttached :
Original file line number Diff line number Diff line change @@ -275,3 +275,8 @@ class ListDnas:
275275@dataclass
276276class ListCellIds :
277277 pass
278+
279+
280+ @dataclass
281+ class DisableApp :
282+ installed_app_id : str
Original file line number Diff line number Diff line change 11import pytest
22from holochain_client .api .admin .types import (
33 AddAdminInterface ,
4+ DisableApp ,
45 DnaModifiers ,
56 EnableApp ,
67 InterfaceDriverWebsocket ,
@@ -158,6 +159,33 @@ async def test_list_apps():
158159 assert apps [0 ].installed_app_id == "test_app"
159160
160161
162+ @pytest .mark .asyncio
163+ async def test_enable_and_disable_app ():
164+ async with TestHarness () as harness :
165+ agent_pub_key = await harness .admin_client .generate_agent_pub_key ()
166+
167+ await harness .admin_client .install_app (
168+ InstallApp (
169+ agent_key = agent_pub_key ,
170+ installed_app_id = "test_app" ,
171+ path = harness .fixture_path ,
172+ )
173+ )
174+
175+ app_info = (await harness .admin_client .list_apps ())[0 ]
176+ assert "disabled" in app_info .status
177+
178+ await harness .admin_client .enable_app (EnableApp ("test_app" ))
179+
180+ app_info = (await harness .admin_client .list_apps ())[0 ]
181+ assert "running" in app_info .status
182+
183+ await harness .admin_client .disable_app (DisableApp ("test_app" ))
184+
185+ app_info = (await harness .admin_client .list_apps ())[0 ]
186+ assert "disabled" in app_info .status
187+
188+
161189@pytest .mark .asyncio
162190async def test_attach_app_interface ():
163191 async with TestHarness () as harness :
You can’t perform that action at this time.
0 commit comments