init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
This commit is contained in:
31
Telegram/ThirdParty/xdg-desktop-portal/tests/test_trash.py
vendored
Normal file
31
Telegram/ThirdParty/xdg-desktop-portal/tests/test_trash.py
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
#
|
||||
# This file is formatted with Python Black
|
||||
|
||||
import tests as xdp
|
||||
|
||||
import os
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
class TestTrash:
|
||||
def test_version(self, portals, dbus_con):
|
||||
xdp.check_version(dbus_con, "Trash", 1)
|
||||
|
||||
def test_trash_file_fails(self, portals, dbus_con):
|
||||
trash_intf = xdp.get_portal_iface(dbus_con, "Trash")
|
||||
with open("/proc/cmdline") as fd:
|
||||
result = trash_intf.TrashFile(fd.fileno())
|
||||
|
||||
assert result == 0
|
||||
|
||||
def test_trash_file(self, portals, dbus_con):
|
||||
trash_intf = xdp.get_portal_iface(dbus_con, "Trash")
|
||||
|
||||
fd, name = tempfile.mkstemp(prefix="trash_portal_mock_", dir=Path.home())
|
||||
result = trash_intf.TrashFile(fd)
|
||||
if result != 1:
|
||||
os.unlink(name)
|
||||
assert result == 1
|
||||
assert not Path(name).exists()
|
||||
Reference in New Issue
Block a user