Skip to content

Integration tests transform endpoint#229

Open
emmanuelmingo wants to merge 1 commit intoc2siorg:mainfrom
emmanuelmingo:integration-tests-transform-endpoint
Open

Integration tests transform endpoint#229
emmanuelmingo wants to merge 1 commit intoc2siorg:mainfrom
emmanuelmingo:integration-tests-transform-endpoint

Conversation

@emmanuelmingo
Copy link
Copy Markdown

Description

Adds integration tests for the POST /projects/{id}/transform endpoint, verifying the full request-response cycle including request parsing, database interaction, file I/O, and response serialization.

Also fixes several bugs uncovered during testing:

  • dataframe_to_response missing default values for page/pageSize, breaking all non-paginated callers
  • get_project_details had required query params with no defaults, returning 422 instead of 404 for deleted projects
  • client test fixture triggered alembic migrations against PostgreSQL on startup, breaking all HTTP-level tests

Fixes #91

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

How Has This Been Tested?

Added 11 pytest integration tests using FastAPI's TestClient with a real SQLite database and temporary CSV files. Each test gets a clean project state via fixtures.

Tests cover:

  • Filter (equals, greater-than, missing params → 400)

  • Sort (ascending, descending)

  • Add row (row count increases)

  • Delete row (specific row removed)

  • Rename column (name updated in response)

  • Invalid operation type → 422

  • Nonexistent project → 404

  • Response shape validation

  • Existing tests pass

  • New tests added

  • Manual testing

Screenshots (if applicable)

N/A

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review
  • I have added/updated documentation as needed
  • My changes generate no new warnings
  • Tests pass locally

- Add test_transform_integration.py with 11 integration tests covering
  filter, sort, addRow, delRow, renameCol, invalid operation, and 404
- Fix conftest.py client fixture to patch alembic so tests run without PostgreSQL
- Fix dataframe_to_response to accept optional page/pageSize with defaults
  so non-paginated callers are not broken
- Fix get_project_details to default page=1, pageSize=100 so missing
  query params return data/404 instead of 422

All tests pass.
@emmanuelmingo emmanuelmingo force-pushed the integration-tests-transform-endpoint branch 2 times, most recently from c0477db to 689f828 Compare March 26, 2026 08:08
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.

Integration Tests for Transform Endpoint

1 participant