Fix test organization by moving ad-hoc test scripts into proper pytest tests
following project conventions. Added 4 new tests to integration and e2e layers
to provide comprehensive coverage for organization members.
Changes:
- tests/integration/test_member_mutations.py:
* Add test_create_organization_member - Tests creating organizations with companyName
* Add test_create_organization_with_contact_person - Tests organizations with contact info
* Import MemberType from models and schemas
- tests/integration/test_member_queries.py:
* Add test_query_mixed_member_types - Tests querying both individual and organization members
* Import MemberType from models
- tests/e2e/test_graphql_api.py:
* Add test_introspect_member_type_enum - Tests GraphQL introspection for MemberType enum
* Verifies INDIVIDUAL and ORGANIZATION enum values
Deleted improper test files:
- test_organization_members.py (root) - Ad-hoc script using httpx directly
- test_mcp_changes.sh (root) - Shell script for MCP server testing
Test results:
- All 57 tests pass (up from 53)
- Organization members now tested at all layers: unit, integration, and e2e
- Tests follow pytest conventions with async patterns and shared fixtures
- Integrated with CI/CD pipeline (proper test/ directory structure)
The proper test structure ensures:
1. Unit tests validate business logic (validation layer)
2. Integration tests verify GraphQL resolvers and database persistence
3. E2E tests confirm full HTTP request/response flows
4. All tests use shared fixtures from conftest.py
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Implements support for both individual persons and organizations as members.
Changes:
- Added MemberType enum (INDIVIDUAL, ORGANIZATION) to distinguish member types
- Added member_type column to database (defaults to INDIVIDUAL for backward compatibility)
- Added company_name field for organizations
- Made first_name nullable (required for individuals, optional for organizations)
- Implemented conditional validation:
- INDIVIDUAL members require first_name
- ORGANIZATION members require company_name
- Updated GraphQL schema with new memberType and companyName fields
- Updated all resolvers to handle new fields and validation
- Added comprehensive unit tests for validation logic
- Updated existing tests to work with new fields
- All 53 tests passing
Technical notes:
- Using memberType instead of 'kind' to avoid GraphQL introspection conflicts
- Using native_enum=False for SQLite compatibility
- Using batch_alter_table for SQLite ALTER COLUMN compatibility
- Backward compatible: existing members automatically become INDIVIDUAL type
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Implemented full test coverage for existing features:
- Unit tests (18 tests): Validation logic for email, phone, firstName
- Integration tests (29 tests): Member model, GraphQL queries/mutations
- E2E tests (5 tests): Complete GraphQL API flows over HTTP
- MCP server tests (12 tests): All 6 MCP tools
Test organization:
- tests/unit/ - Pure logic tests
- tests/integration/ - Database and resolver tests
- tests/e2e/ - Full API request/response tests
- tests/mcp/ - MCP server tool tests
- tests/conftest.py - Shared fixtures
All 57 tests passing ✓
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>