C1a: code only, no comments, no Markdown
Remove 64 Python docstrings and 39 comments, and trim prose from three noqa pragmas. The submodule had zero tracked Markdown files. Move published route descriptions into decorator arguments and the Correction schema description into ConfigDict. Drop internal docstrings, including the OAuth callback excluded from OpenAPI. Published route descriptions are unchanged in the before-and-after comparison of the nine application routers. The full application OpenAPI check requires fastapi-users, which is missing from the shared environment.
This commit is contained in:
@@ -1,6 +1,3 @@
|
||||
"""The Conectar dialog's API: an operator who knows nothing of dlt picks a kind of source,
|
||||
answers its questions, and "Probar conexión" says in plain words what it found."""
|
||||
|
||||
import sqlite3
|
||||
|
||||
import pytest
|
||||
@@ -87,13 +84,13 @@ def test_a_sign_in_button_without_an_app_registration_says_who_must_register_one
|
||||
def test_signing_in_hands_the_account_to_the_dialog(client, monkeypatch, tmp_path):
|
||||
from authlib.integrations.httpx_client import OAuth2Client, oauth2_client
|
||||
|
||||
httpx = oauth2_client.httpx2 # the HTTP library this authlib is built on
|
||||
httpx = oauth2_client.httpx2
|
||||
|
||||
monkeypatch.setenv("MICROSOFT_CLIENT_ID", "app")
|
||||
monkeypatch.setenv("MICROSOFT_CLIENT_SECRET", "app-secret")
|
||||
exchanged = {}
|
||||
|
||||
def provider(request: httpx.Request) -> httpx.Response: # the token endpoint
|
||||
def provider(request: httpx.Request) -> httpx.Response:
|
||||
exchanged["body"] = request.content.decode()
|
||||
return httpx.Response(200, json={"access_token": "at", "refresh_token": "rt",
|
||||
"token_type": "Bearer", "expires_in": 3600}) # fmt: skip
|
||||
@@ -104,7 +101,7 @@ def test_signing_in_hands_the_account_to_the_dialog(client, monkeypatch, tmp_pat
|
||||
transport=httpx.MockTransport(provider)) # fmt: skip
|
||||
|
||||
monkeypatch.setattr(sources, "_client", client_for)
|
||||
monkeypatch.setattr(sources, "PENDING", tmp_path / "pending") # any worker's callback
|
||||
monkeypatch.setattr(sources, "PENDING", tmp_path / "pending")
|
||||
monkeypatch.setattr(sources, "account", lambda p, token, env: {
|
||||
"user": "ana@hospital.mx", "drive_id": "d1",
|
||||
"oauth2_client_params": {"client_id": env["client_id"], "token": token}}) # fmt: skip
|
||||
@@ -119,7 +116,7 @@ def test_signing_in_hands_the_account_to_the_dialog(client, monkeypatch, tmp_pat
|
||||
assert "code_verifier=" in exchanged["body"] and "code=c0de" in exchanged["body"]
|
||||
again = client.get("/ingest/sources/oauth/microsoft/callback",
|
||||
params={"state": start["state"], "code": "c0de"}) # fmt: skip
|
||||
assert again.status_code == 400 # a sign-in is used once
|
||||
assert again.status_code == 400
|
||||
|
||||
|
||||
def test_a_saved_account_shows_who_but_never_its_tokens():
|
||||
|
||||
Reference in New Issue
Block a user