test: Reorganize organization member tests into proper pytest structure
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>
This commit is contained in:
@@ -153,3 +153,31 @@ class TestGraphQLAPI:
|
||||
# The error should mention validation
|
||||
error_message = str(data["errors"])
|
||||
assert "Invalid email format" in error_message or "email" in error_message.lower()
|
||||
|
||||
async def test_introspect_member_type_enum(self, graphql_client):
|
||||
"""Test GraphQL introspection returns MemberType enum."""
|
||||
query = """
|
||||
query {
|
||||
__type(name: "MemberType") {
|
||||
name
|
||||
kind
|
||||
enumValues {
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
response = await graphql_client.post("/graphql", json={"query": query})
|
||||
assert response.status_code == 200
|
||||
|
||||
data = response.json()
|
||||
assert "data" in data
|
||||
|
||||
member_type = data["data"]["__type"]
|
||||
assert member_type["name"] == "MemberType"
|
||||
assert member_type["kind"] == "ENUM"
|
||||
|
||||
enum_values = {ev["name"] for ev in member_type["enumValues"]}
|
||||
assert "INDIVIDUAL" in enum_values
|
||||
assert "ORGANIZATION" in enum_values
|
||||
|
||||
Reference in New Issue
Block a user