feat: add support for EXTERNAL auth without uid (#193)

This commit is contained in:
mvn23
2023-01-07 20:46:55 +01:00
committed by GitHub
parent 4c9a8fe15a
commit 4939ef80e5
2 changed files with 21 additions and 1 deletions

View File

@@ -3,9 +3,19 @@ import os
import pytest
from dbus_fast.auth import AuthExternal
from dbus_fast.auth import UID_NOT_SPECIFIED, AuthExternal
from dbus_fast.errors import AuthError
def test_uid_is_set():
auth = AuthExternal(uid=999)
assert auth._authentication_start() == "AUTH EXTERNAL 393939"
def test_auth_external_no_uid():
"""Test AuthExternal with UID_NOT_SPECIFIED"""
auth = AuthExternal(uid=UID_NOT_SPECIFIED)
assert auth._authentication_start() == "AUTH EXTERNAL"
assert auth._receive_line("DATA") == "DATA"
with pytest.raises(AuthError):
auth._receive_line("REJECTED")