Skip to content

Derive mock query names/tables; drop the Mock prefix - #17

Merged
adsharma merged 2 commits into
mainfrom
mock-names-derive
Oct 5, 2026
Merged

adsharma merged 2 commits into
mainfrom
mock-names-derive

Conversation

@adsharma

@adsharma adsharma commented Oct 5, 2026

Copy link
Copy Markdown
Owner

Follow-up to #16. The Mock prefix on fixture nodes was the only thing forcing explicit query names and TABLE overrides — the fixtures are users and reviews, so name them that way:

  • MockUser/MockReview → User/Review in tests/mock_user.py
  • UserQuery = User.query() / ReviewQuery = Review.query() — class name, predicate prefix and table (user, review) all derive, nothing repeated
  • GraphQL test subclasses re-based on the new names

51 passed. Explicit TABLE/namespace stays for genuinely irregular mappings (legacy schemas) — the rule is now derive-by-default, override-when-necessary.

make_query_type already defaults the query name, so the explicit QUERY_NAME attrs on mock nodes were redundant. The two things they actually pinned (query class name for predicate prefixes, table name for SQL) now travel explicitly: MockUser.query({"TABLE": "user"}, "UserQuery"). node.query() forwards both to make_query_type; bare .query() still caches by node.
MockUser/MockReview -> User/Review. With QUERY_NAME gone, the Mock prefix was the only thing forcing explicit names and TABLE overrides: UserQuery = User.query() now derives the class name, predicate prefix and table (user) with nothing repeated. Same for Review. GraphQL subclasses updated to the new bases.
@adsharma
adsharma merged commit a1ce7c6 into main Oct 5, 2026
2 checks passed
@adsharma
adsharma deleted the mock-names-derive branch October 5, 2026 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant