Skip to content

Commit 15e32c9

Browse files
nanotaboadaclaude
andcommitted
test(tests): normalize player stub to fake, rename 404 test (#559)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent c07988a commit 15e32c9

File tree

4 files changed

+27
-11
lines changed

4 files changed

+27
-11
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ This project uses famous football coaches as release codenames, following an A-Z
5353

5454
### Changed
5555

56+
- `tests/player_stub.py` renamed to `tests/player_fake.py`; class docstring
57+
updated to reflect fake (not stub) role; module-level docstring added
58+
documenting the three-term data-state vocabulary (`existing`, `nonexistent`,
59+
`unknown`); imports in `conftest.py` and `test_main.py` updated accordingly;
60+
`test_request_get_player_id_nonexistent_response_status_not_found` renamed to
61+
`test_request_get_player_id_unknown_response_status_not_found` (#559)
5662
- `GET /players/` cache check changed from `if not players` to
5763
`if players is None` so that an empty collection is cached correctly
5864
instead of triggering a DB fetch on every request (#530)

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import pytest
55
from fastapi.testclient import TestClient
66
from main import app
7-
from tests.player_stub import Player, nonexistent_player
7+
from tests.player_fake import Player, nonexistent_player
88

99
# Suppress the DeprecationWarning from httpx
1010
warnings.filterwarnings("ignore", category=DeprecationWarning)
Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
1+
"""
2+
Test fakes for Player data-state scenarios.
3+
4+
Three-term vocabulary:
5+
existing — player is present in the database
6+
nonexistent — player is absent, valid shape for creation (POST scenarios)
7+
unknown — valid ID format, absent from database (404-by-lookup scenarios)
8+
"""
9+
10+
111
class Player:
212
"""
3-
Test stub representing a Player.
13+
Test fake representing a Player.
414
"""
515

616
def __init__(
@@ -30,9 +40,9 @@ def __init__(
3040
self.starting11 = starting11
3141

3242

33-
def existing_player():
43+
def existing_player() -> Player:
3444
"""
35-
Creates a test stub for an existing Player.
45+
Creates a test fake for an existing Player.
3646
"""
3747
return Player(
3848
id="01772c59-43f0-5d85-b913-c78e4e281452",
@@ -49,9 +59,9 @@ def existing_player():
4959
)
5060

5161

52-
def nonexistent_player():
62+
def nonexistent_player() -> Player:
5363
"""
54-
Creates a test stub for a nonexistent (new) Player.
64+
Creates a test fake for a nonexistent (new) Player.
5565
No id is provided; the server generates a UUID on creation.
5666
"""
5767
return Player(
@@ -67,9 +77,9 @@ def nonexistent_player():
6777
)
6878

6979

70-
def unknown_player():
80+
def unknown_player() -> Player:
7181
"""
72-
Creates a test stub for an unknown Player (valid UUID format, not in database).
82+
Creates a test fake for an unknown Player (valid UUID format, not in database).
7383
"""
7484
return Player(
7585
id="00000000-0000-0000-0000-000000000000",

tests/test_main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
from uuid import UUID
2020

21-
from tests.player_stub import (
21+
from tests.player_fake import (
2222
existing_player,
2323
nonexistent_player,
2424
unknown_player,
@@ -92,8 +92,8 @@ def test_request_get_players_response_body_each_player_has_uuid(client):
9292
# GET /players/{player_id} -----------------------------------------------------
9393

9494

95-
def test_request_get_player_id_nonexistent_response_status_not_found(client):
96-
"""GET /players/{player_id} with nonexistent UUID returns 404 Not Found"""
95+
def test_request_get_player_id_unknown_response_status_not_found(client):
96+
"""GET /players/{player_id} with unknown UUID returns 404 Not Found"""
9797
# Arrange
9898
player_id = unknown_player().id
9999
# Act

0 commit comments

Comments
 (0)