Add tests for learn's survey API handlers

オープン
#1,127 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@KanishJebaMathewM がすでに取り組んでいます。

2026年11月3日 から。

  • #1198 @KanishJebaMathewM による — オープン

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
72/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
testing

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
HTML
スター
66
フォーク
181
平均マージ
2時間 21分
マージ済み PR(30日)
13

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

alphaonelabs/website のほかの issue

alphaonelabs/website の issue をすべて見る

似ている issue

Testing & QA の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。