Add tests for learn's survey API handlers

Abierto
#1,127 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@KanishJebaMathewM ya está trabajando en esto.

Desde el 3/11/2026.

  • #1198 de @KanishJebaMathewM — abierto

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
72/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python
Área
testing

Línea de trabajo

Start with learn/tests/test_quizzes.py to see how MockDB and make_stmt from learn/tests/helpers.py are used, and check learn/tests/conftest.py for the Workers stubs. Then read the six survey handlers in learn/src/worker.py (around lines 3894 to 4201) to see their auth, validation and ownership checks. Done means a new learn/tests/test_surveys.py with a success and a failure test per handler, passing via cd learn && python -m pytest -q in under a second, with worker.py unchanged.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

learn has six survey endpoints with no tests at all: api_list_surveys (~line 3894), api_create_survey (~3931), api_get_survey (~4075), api_submit_survey (~4087), api_delete_survey (~4163) and api_survey_results (~4201) in learn/src/worker.py. No file under learn/tests/ references them. 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
  • Create learn/tests/test_surveys.py, following the style of test_quizzes.py (it uses the same MockDB / make_stmt helpers).
  • Cover: unauthenticated requests (401), validation errors (400) on create/submit, a non-owner trying to delete or read results (403/404), and the happy path for each handler.
  • If you find a real bug while writing the tests, open a separate issue or fix it in its own commit with a regression test.
Acceptance criteria
  • Each of the six handlers has at least one success and one failure test.
  • The new file passes locally and does not slow the suite noticeably (< 1 s).
  • No changes to worker.py unless they fix a bug a new test exposes.
Files
  • learn/tests/test_surveys.py (new)
  • learn/tests/test_quizzes.py (pattern to copy)
  • learn/tests/helpers.py
  • learn/src/worker.py (survey handlers)
Helpful links
  • learn/public/surveys.html (the UI that calls these endpoints)

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

Lenguaje dominante
HTML
Estrellas
66
Forks
181
Merge medio
2 h 21 min
PR fusionados (30 d)
13

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de alphaonelabs/website

Todos los issues de alphaonelabs/website

Issues similares

Más issues de Testing & QA

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.