From 877f02fe826ed9d5893aca507f62a5e6dcfc704c Mon Sep 17 00:00:00 2001 From: imacat Date: Thu, 8 Jun 2023 17:20:24 +0800 Subject: [PATCH] Added missing documentation to the global variables and class and object properties. --- tests/test_auth.py | 10 ++++++++-- tests/test_flask_login.py | 13 +++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/tests/test_auth.py b/tests/test_auth.py index 5a0c208..4c7357e 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -29,8 +29,11 @@ from werkzeug.datastructures import WWWAuthenticate, Authorization from flask_digest_auth import DigestAuth, make_password_hash, Client _REALM: str = "testrealm@host.com" +"""The realm.""" _USERNAME: str = "Mufasa" +"""The username.""" _PASSWORD: str = "Circle Of Life" +"""The password.""" class User: @@ -43,9 +46,11 @@ class User: :param password: The clear-text password. """ self.username: str = username - self.password_hash: str = make_password_hash( - _REALM, username, password) + """The username.""" + self.password_hash: str = make_password_hash(_REALM, username, password) + """The password hash.""" self.visits: int = 0 + """The number of visits.""" class AuthenticationTestCase(TestCase): @@ -68,6 +73,7 @@ class AuthenticationTestCase(TestCase): auth: DigestAuth = DigestAuth() auth.init_app(app) self.user: User = User(_USERNAME, _PASSWORD) + """The user account.""" user_db: Dict[str, User] = {_USERNAME: self.user} @auth.register_get_password diff --git a/tests/test_flask_login.py b/tests/test_flask_login.py index e6fa7a4..638e226 100644 --- a/tests/test_flask_login.py +++ b/tests/test_flask_login.py @@ -29,8 +29,11 @@ from werkzeug.datastructures import WWWAuthenticate, Authorization from flask_digest_auth import DigestAuth, make_password_hash, Client _REALM: str = "testrealm@host.com" +"""The realm.""" _USERNAME: str = "Mufasa" +"""The username.""" _PASSWORD: str = "Circle Of Life" +"""The password.""" class User: @@ -43,11 +46,15 @@ class User: :param password: The clear-text password. """ self.username: str = username - self.password_hash: str = make_password_hash( - _REALM, username, password) + """The username.""" + self.password_hash: str = make_password_hash(_REALM, username, password) + """The password hash.""" self.visits: int = 0 + """The number of visits.""" self.is_active: bool = True + """True if the account is active, or False otherwise.""" self.is_anonymous: bool = False + """True if the account is anonymous, or False otherwise.""" def get_id(self) -> str: """Returns the username. @@ -86,6 +93,7 @@ class FlaskLoginTestCase(TestCase): app.test_client_class = Client self.has_flask_login: bool = True + """Whether the Flask-Login package is installed.""" try: import flask_login except ModuleNotFoundError: @@ -99,6 +107,7 @@ class FlaskLoginTestCase(TestCase): auth.init_app(app) self.user: User = User(_USERNAME, _PASSWORD) + """The user account.""" user_db: Dict[str, User] = {_USERNAME: self.user} @auth.register_get_password