@@ -20,7 +20,11 @@ RUN pip3 install -r requirements.txt
|
||||
|
||||
ADD . /app
|
||||
|
||||
COPY data/test/dbus-system.conf /etc/dbus-1/system.d/test-dbus-system.conf
|
||||
|
||||
RUN meson --prefix=/usr build && \
|
||||
ninja -C build && ninja -C build install
|
||||
RUN mkdir -p /run/dbus
|
||||
ENV PYTHONASYNCIODEBUG=1
|
||||
CMD ["dbus-run-session", "python3", "-m", "pytest", "-svv"]
|
||||
ENV DBUS_SYSTEM_BUS_ADDRESS=unix:path=/var/run/dbus/system_bus_socket
|
||||
CMD ["bash", "-c", "dbus-daemon --nopidfile --system && dbus-run-session python3 -m pytest -vv"]
|
||||
|
14
data/test/dbus-system.conf
Normal file
14
data/test/dbus-system.conf
Normal file
@@ -0,0 +1,14 @@
|
||||
<!DOCTYPE busconfig PUBLIC
|
||||
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
||||
<busconfig>
|
||||
<!-- This is only to be used in the test docker container -->
|
||||
<policy user="root">
|
||||
<allow own="*"/>
|
||||
</policy>
|
||||
|
||||
<policy context="default">
|
||||
<allow send_destination="*"/>
|
||||
<allow receive_sender="*"/>
|
||||
</policy>
|
||||
</busconfig>
|
@@ -1026,7 +1026,6 @@ GList *playerctl_list_players(GError **err) {
|
||||
}
|
||||
|
||||
GList *players = g_list_concat(session_players, system_players);
|
||||
g_list_free(system_players);
|
||||
|
||||
return players;
|
||||
}
|
||||
|
@@ -1,13 +1,18 @@
|
||||
from dbus_next.service import ServiceInterface, dbus_property, method, signal, Variant
|
||||
from dbus_next import PropertyAccess, RequestNameReply
|
||||
from dbus_next import PropertyAccess, RequestNameReply, BusType
|
||||
from dbus_next.aio import MessageBus
|
||||
|
||||
import asyncio
|
||||
|
||||
|
||||
async def setup_mpris(*names, bus_address=None):
|
||||
async def setup_mpris(*names, bus_address=None, system=False):
|
||||
async def setup(name):
|
||||
bus = await MessageBus(bus_address=bus_address).connect()
|
||||
if system:
|
||||
bus_type = BusType.SYSTEM
|
||||
else:
|
||||
bus_type = BusType.SESSION
|
||||
bus = await MessageBus(bus_type=bus_type,
|
||||
bus_address=bus_address).connect()
|
||||
player = MprisPlayer(bus)
|
||||
bus.export('/org/mpris/MediaPlayer2', player)
|
||||
bus.export('/org/mpris/MediaPlayer2', MprisRoot())
|
||||
|
@@ -58,6 +58,18 @@ async def test_list_names(bus_address):
|
||||
mpris.disconnect()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_system_list_players(bus_address):
|
||||
system_players = await setup_mpris('system', system=True)
|
||||
session_players = await setup_mpris('session1', bus_address=bus_address)
|
||||
playerctl = PlayerctlCli(bus_address, debug=False)
|
||||
result = await playerctl.run('-l')
|
||||
assert result.returncode == 0, result.stdout
|
||||
assert result.stdout.split() == ['session1', 'system']
|
||||
for mpris in system_players + session_players:
|
||||
mpris.disconnect()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_queries(bus_address):
|
||||
[mpris] = await setup_mpris('queries', bus_address=bus_address)
|
||||
|
Reference in New Issue
Block a user