Reordered the code in the test cases.

This commit is contained in:
2022-11-23 23:36:41 +11:00
parent bf15bcf1f1
commit 292d0aaf09
2 changed files with 19 additions and 18 deletions

View File

@ -40,6 +40,13 @@ class AuthenticationTestCase(TestCase):
:return: The Flask application.
"""
app: Flask = Flask(__name__)
app.config.from_mapping({
"SECRET_KEY": token_urlsafe(32),
"TESTING": True
})
app.test_client_class = Client
auth: DigestAuth = DigestAuth(realm=_REALM)
user_db: t.Dict[str, str] \
= {_USERNAME: make_password_hash(_REALM, _USERNAME, _PASSWORD)}
@ -63,13 +70,6 @@ class AuthenticationTestCase(TestCase):
return SimpleNamespace(username=username) if username in user_db \
else None
app: Flask = Flask(__name__)
app.config.from_mapping({
"SECRET_KEY": token_urlsafe(32),
"TESTING": True
})
app.test_client_class = Client
@app.get("/login-required-1/auth", endpoint="auth-1")
@auth.login_required
def login_required_1() -> str: