Cleanup previous PR

This commit is contained in:
Kovid Goyal 2026-04-23 12:51:27 +05:30
parent ab75388bd0
commit cadaec5712
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 6 additions and 3 deletions

View file

@ -809,9 +809,11 @@ class TestDnDProtocol(BaseTest):
"""A broken symlink in the URI list is transmitted as a symlink (X=1) with the target."""
import os
import tempfile
import uuid
does_not_exist = '/' + str(uuid.uuid4())
with tempfile.TemporaryDirectory() as root:
broken_link = os.path.join(root, 'broken.txt')
os.symlink('/does-not-exist', broken_link)
os.symlink(does_not_exist, broken_link)
uri_list = f'file://{broken_link}\r\n'.encode()
with dnd_test_window() as (screen, cap):
self._setup_uri_drop(screen, cap, uri_list)
@ -823,7 +825,7 @@ class TestDnDProtocol(BaseTest):
self.assertEqual(r_events[0]['meta'].get('X'), '1',
'broken symlink response must have X=1')
target = b''.join(e['payload'] for e in r_events if e['payload'])
self.ae(target, b'/does-not-exist')
self.ae(target, does_not_exist.encode())
def test_uri_non_broken_symlink_to_file_transmitted_as_file(self) -> None:
"""A non-broken symlink to a regular file is transmitted as the file content, not as a symlink."""

View file

@ -5,6 +5,7 @@ import os
import random
import shutil
import tempfile
import uuid
from base64 import standard_b64encode
from functools import partial
from urllib.parse import unquote, urlparse
@ -42,7 +43,7 @@ def create_fs(base):
f.write(b'x' * sz)
os.makedirs(join('d1', 'sd', 'ssd'))
os.mkdir(join('d2'))
os.symlink('/does-not-exist', join('s1'))
os.symlink('/' + str(uuid.uuid4()), join('s1'))
os.symlink('d1', join('sd'))
os.symlink('/', join('sr'))
os.symlink('../d1', join('d1', 'sr'))