Fix the 7 failing registration tests in learn after the stronger password rules

Aperta Adatta ai principianti
#1,124 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@KanishJebaMathewM ci sta già lavorando.

Dal 3/11/2026.

  • #1202 di @KanishJebaMathewM — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
Mezza giornata
Idoneità per principianti
82/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python

Direzione di ricerca

Inizia da learn/tests/test_api_auth.py nella classe TestApiRegister, dove le fixture di registrazione usano "password123", e leggi validate_password_strength() in learn/src/worker.py per vedere le regole che applica. Esegui cd learn && python -m pytest -q (tests/conftest.py simula il runtime di Workers) per confermare i 7 fallimenti indicati. È completato quando questi test passano con una password conforme alla policy e i nuovi test verificano che ogni regola restituisca un 400 con il suo messaggio, senza modificare il codice di produzione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

2026-11 good first issue gsoc-2027 project: learn tests
Context

learn now enforces a strong password policy in validate_password_strength() (learn/src/worker.py ~line 1705): at least one uppercase letter, lowercase letter, number and symbol, plus a common-password blocklist. The tests in learn/tests/test_api_auth.py::TestApiRegister still register users with "password123", so api_register returns 400 "Password must include an uppercase letter" and 7 tests fail on main:

test_successful_registration, test_name_defaults_to_username, test_custom_name_preserved, test_duplicate_user_returns_409, test_db_error_returns_500, test_registration_sends_verification_message, test_register_is_rate_limited_per_ip.

This is the first slice of the GSoC 2027 starter idea "Make learn's test suite green". Run the suite with cd learn && pip install pytest pytest-asyncio && python -m pytest -q (no Cloudflare account needed; tests/conftest.py stubs the Workers runtime).

What to do
  • Update the fixtures in TestApiRegister to use a password that satisfies the policy (e.g. a module-level STRONG_PASSWORD constant), without weakening validate_password_strength().
  • Add one test per rule (missing uppercase, lowercase, digit, symbol; common password; password containing the username) so the policy itself is covered by api_register tests, not just by the helper.
Acceptance criteria
  • All 7 tests above pass.
  • New tests cover each password-rule rejection with a 400 and the rule's message.
  • No production code changes, unless you find a genuine bug (explain it in the PR).
Files
  • learn/tests/test_api_auth.py
  • learn/src/worker.py (validate_password_strength, api_register)
Helpful links

Part of GSoC 2027 onboarding — see https://gsoc.alphaonelabs.com

Lingua principale
HTML
Stelle
66
Fork
181
Merge medio
2h 21m
PR unite (30g)
13

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di alphaonelabs/website

Tutte le issue di alphaonelabs/website

Issue simili

Altre issue su Security

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.