@@ -238,6 +238,83 @@ async def test_update_password(self, nc_mcp: McpTestHelper) -> None:
238238 updated = json .loads (result )
239239 assert updated .get ("has_password" ) is True
240240
241+ @pytest .mark .asyncio
242+ async def test_update_remove_password (self , nc_mcp : McpTestHelper ) -> None :
243+ await _setup_share_file (nc_mcp )
244+ created = json .loads (
245+ await nc_mcp .call ("create_share" , path = f"/{ SHARE_FILE } " , share_type = 3 , password = "s3Cr3t!Pw9#xK" )
246+ )
247+ share_id = int (created ["id" ])
248+ assert created .get ("has_password" ) is True
249+ result = await nc_mcp .call ("update_share" , share_id = share_id , password = "" )
250+ updated = json .loads (result )
251+ assert updated .get ("has_password" ) is not True
252+
253+ @pytest .mark .asyncio
254+ async def test_update_remove_expiration (self , nc_mcp : McpTestHelper ) -> None :
255+ await _setup_share_file (nc_mcp )
256+ created = json .loads (
257+ await nc_mcp .call ("create_share" , path = f"/{ SHARE_FILE } " , share_type = 3 , expire_date = "2099-12-31" )
258+ )
259+ share_id = int (created ["id" ])
260+ assert created ["expiration" ] is not None
261+ result = await nc_mcp .call ("update_share" , share_id = share_id , expire_date = "" )
262+ updated = json .loads (result )
263+ assert updated ["expiration" ] is None
264+
265+ @pytest .mark .asyncio
266+ async def test_update_clear_note (self , nc_mcp : McpTestHelper ) -> None :
267+ await _setup_share_file (nc_mcp )
268+ created = json .loads (
269+ await nc_mcp .call ("create_share" , path = f"/{ SHARE_FILE } " , share_type = 3 , note = "initial note" )
270+ )
271+ share_id = int (created ["id" ])
272+ assert created ["note" ] == "initial note"
273+ result = await nc_mcp .call ("update_share" , share_id = share_id , note = "" )
274+ updated = json .loads (result )
275+ assert updated ["note" ] == ""
276+
277+ @pytest .mark .asyncio
278+ async def test_update_clear_label (self , nc_mcp : McpTestHelper ) -> None :
279+ await _setup_share_file (nc_mcp )
280+ created = json .loads (
281+ await nc_mcp .call ("create_share" , path = f"/{ SHARE_FILE } " , share_type = 3 , label = "Initial Label" )
282+ )
283+ share_id = int (created ["id" ])
284+ assert created ["label" ] == "Initial Label"
285+ result = await nc_mcp .call ("update_share" , share_id = share_id , label = "" )
286+ updated = json .loads (result )
287+ assert updated ["label" ] == ""
288+
289+ @pytest .mark .asyncio
290+ async def test_update_enable_hide_download (self , nc_mcp : McpTestHelper ) -> None :
291+ await _setup_share_file (nc_mcp )
292+ created = json .loads (await nc_mcp .call ("create_share" , path = f"/{ SHARE_FILE } " , share_type = 3 ))
293+ share_id = int (created ["id" ])
294+ result = await nc_mcp .call ("update_share" , share_id = share_id , hide_download = True )
295+ updated = json .loads (result )
296+ assert updated .get ("hide_download" ) == 1
297+
298+ @pytest .mark .asyncio
299+ async def test_update_disable_hide_download (self , nc_mcp : McpTestHelper ) -> None :
300+ await _setup_share_file (nc_mcp )
301+ created = json .loads (await nc_mcp .call ("create_share" , path = f"/{ SHARE_FILE } " , share_type = 3 ))
302+ share_id = int (created ["id" ])
303+ await nc_mcp .call ("update_share" , share_id = share_id , hide_download = True )
304+ result = await nc_mcp .call ("update_share" , share_id = share_id , hide_download = False )
305+ updated = json .loads (result )
306+ assert not updated .get ("hide_download" )
307+
308+ @pytest .mark .asyncio
309+ async def test_update_disable_public_upload (self , nc_mcp : McpTestHelper ) -> None :
310+ await _setup_share_file (nc_mcp )
311+ created = json .loads (await nc_mcp .call ("create_share" , path = f"/{ SHARE_DIR } " , share_type = 3 , public_upload = True ))
312+ share_id = int (created ["id" ])
313+ assert created ["permissions" ] & 4 , "Should have create permission"
314+ result = await nc_mcp .call ("update_share" , share_id = share_id , public_upload = False )
315+ updated = json .loads (result )
316+ assert not (updated ["permissions" ] & 4 ), "Create permission should be removed"
317+
241318 @pytest .mark .asyncio
242319 async def test_update_nonexistent_share_fails (self , nc_mcp : McpTestHelper ) -> None :
243320 with pytest .raises (ToolError ):
0 commit comments