Problem
setup.py handles first-run key setup, but its validation logic (200 vs 401
vs 403 vs network error) and .env loading are untested — exactly the paths
new users hit first.
Proposed approach
- Mock
requests.get to cover: 200 → valid, 401 → invalid-key message,
403 → forbidden message, ConnectionError/timeout → network message.
- Test
load_env (reads ~/.gcode/.env when present, no-op otherwise),
get_api_key precedence, and save_api_key round-trip.
Where to look
gcode/setup.py:27-60 (get_api_key, load_env, validate_api_key),
:80-89 (save_api_key)
- Pattern:
tests/test_models.py mock-based tests.
Acceptance criteria
- New
tests/test_setup.py covering the matrix above; all pass.
Difficulty
Low — good first issue.
Problem
setup.pyhandles first-run key setup, but its validation logic (200 vs 401vs 403 vs network error) and
.envloading are untested — exactly the pathsnew users hit first.
Proposed approach
requests.getto cover: 200 → valid, 401 → invalid-key message,403 → forbidden message,
ConnectionError/timeout → network message.load_env(reads~/.gcode/.envwhen present, no-op otherwise),get_api_keyprecedence, andsave_api_keyround-trip.Where to look
gcode/setup.py:27-60(get_api_key,load_env,validate_api_key),:80-89(save_api_key)tests/test_models.pymock-based tests.Acceptance criteria
tests/test_setup.pycovering the matrix above; all pass.Difficulty
Low — good first issue.