File tree Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -357,7 +357,7 @@ async def delete_smart_app(
357357 async def get_installed_app (
358358 self , personal_access_token : str , installed_app_id : str
359359 ) -> InstalledApp :
360- """Delete a SmartApp."""
360+ """Retrieve an installed SmartApp."""
361361 url = URL .build (
362362 scheme = "https" ,
363363 host = API_BASE ,
@@ -372,6 +372,23 @@ async def get_installed_app(
372372 resp = await self .__internal_request (METH_GET , url , headers )
373373 return InstalledApp .from_json (resp )
374374
375+ async def delete_installed_app (
376+ self , personal_access_token : str , installed_app_id : str
377+ ) -> None :
378+ """Delete an installed SmartApp."""
379+ url = URL .build (
380+ scheme = "https" ,
381+ host = API_BASE ,
382+ port = 443 ,
383+ ).joinpath (f"v1/installedapps/{ installed_app_id } " )
384+
385+ headers = {
386+ "Accept" : f"application/vnd.smartthings+json;v={ API_VERSION } " ,
387+ "Authorization" : f"Bearer { personal_access_token } " ,
388+ }
389+
390+ await self .__internal_request (METH_DELETE , url , headers )
391+
375392 async def execute_device_command (
376393 self ,
377394 device_id : str ,
Original file line number Diff line number Diff line change @@ -30,6 +30,26 @@ async def test_deleting_smart_app(
3030 )
3131
3232
33+ async def test_deleting_installed_app (
34+ client : SmartThings ,
35+ responses : aioresponses ,
36+ ) -> None :
37+ """Test deleting an installed SmartApp."""
38+ responses .delete (
39+ f"{ MOCK_URL } /v1/installedapps/4514eb36-f5fd-4ab2-9520-0597acd1d212" , status = 200
40+ )
41+ await client .delete_installed_app (
42+ "abcabcabcabc" , "4514eb36-f5fd-4ab2-9520-0597acd1d212"
43+ )
44+ responses .assert_called_once_with (
45+ f"{ MOCK_URL } /v1/installedapps/4514eb36-f5fd-4ab2-9520-0597acd1d212" ,
46+ METH_DELETE ,
47+ headers = {** HEADERS , "Authorization" : "Bearer abcabcabcabc" },
48+ params = None ,
49+ json = None ,
50+ )
51+
52+
3353async def test_get_installed_app (
3454 client : SmartThings ,
3555 responses : aioresponses ,
You can’t perform that action at this time.
0 commit comments