From 6c2412f4ca214f1fc95046ab8118bf330aa646da Mon Sep 17 00:00:00 2001 From: Jim Duchek Date: Sat, 5 Aug 2023 13:41:09 -0700 Subject: [PATCH] fix: spelling of `dbus_fast.auth.AuthAnnonymous` to `dbus_fast.auth.AuthAnonymous` (#220) --- docs/source/authentication.rst | 2 +- src/dbus_fast/auth.py | 10 +++++++--- tests/test_auth.py | 12 +++++++++++- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/docs/source/authentication.rst b/docs/source/authentication.rst index 39f667e..bca14c2 100644 --- a/docs/source/authentication.rst +++ b/docs/source/authentication.rst @@ -6,4 +6,4 @@ Classes for the DBus `authentication protocol `. :sealso: https://dbus.freedesktop.org/doc/dbus-specification.html#auth-protocol @@ -109,7 +109,7 @@ class AuthAnnonymous(Authenticator): def _authentication_start(self, negotiate_unix_fd: bool = False) -> str: if negotiate_unix_fd: raise AuthError( - "annonymous authentication does not support negotiating unix fds right now" + "anonymous authentication does not support negotiating unix fds right now" ) return "AUTH ANONYMOUS" @@ -121,3 +121,7 @@ class AuthAnnonymous(Authenticator): raise AuthError(f"authentication failed: {response.value}: {args}") return "BEGIN" + + +# The following line provides backwards compatibility, remove at some point? --jrd +AuthAnnonymous = AuthAnonymous diff --git a/tests/test_auth.py b/tests/test_auth.py index 8c86056..bc8a90c 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -3,10 +3,20 @@ import os import pytest -from dbus_fast.auth import UID_NOT_SPECIFIED, AuthExternal +from dbus_fast.auth import ( + UID_NOT_SPECIFIED, + AuthAnnonymous, + AuthAnonymous, + AuthExternal, +) from dbus_fast.errors import AuthError +def test_annonymous_backcompat(): + auth = AuthAnnonymous() + assert isinstance(auth, AuthAnonymous) + + def test_uid_is_set(): auth = AuthExternal(uid=999) assert auth._authentication_start() == "AUTH EXTERNAL 393939"