checkmate-cli 0.4.1

Checkmate - API Testing Framework CLI
name: "Error Handling Tests"
description: "Test error responses for invalid requests"

env:
  base_url: "http://localhost:80"
  timeout_ms: 10000

requests:
  missing_email:
    body:
      name: "Test User"
      ip: "192.168.1.1"
      user_agent: "TestAgent/1.0"

  missing_ip:
    body:
      name: "Test User"
      email: "test@example.com"
      user_agent: "TestAgent/1.0"

  missing_user_agent:
    body:
      name: "Test User"
      email: "test@example.com"
      ip: "192.168.1.1"

  missing_name:
    body:
      email: "test@example.com"
      ip: "192.168.1.1"
      user_agent: "TestAgent/1.0"

  missing_all_required:
    body:
      ticket_count: 1

  empty_body:
    body: {}

tests:
  error_missing_email:
    description: "Expect 422 when email is missing"
    endpoint: /api/v1/check-order
    expect_status: 422
    requests: [missing_email]
    assertions:
      - query: "$[detail]?"
        expect: true
        message: "Error response should contain detail field"
      - query: "$[detail]"
        expect_type: array
        message: "detail should be an array of validation errors"

  error_missing_ip:
    description: "Expect 422 when ip is missing"
    endpoint: /api/v1/check-order
    expect_status: 422
    requests: [missing_ip]
    assertions:
      - query: "$[detail]?"
        expect: true
        message: "Error response should contain detail field"

  error_missing_user_agent:
    description: "Expect 422 when user_agent is missing"
    endpoint: /api/v1/check-order
    expect_status: 422
    requests: [missing_user_agent]
    assertions:
      - query: "$[detail]?"
        expect: true
        message: "Error response should contain detail field"

  error_missing_name:
    description: "Expect 422 when name is missing"
    endpoint: /api/v1/check-order
    expect_status: 422
    requests: [missing_name]
    assertions:
      - query: "$[detail]?"
        expect: true
        message: "Error response should contain detail field"

  error_missing_all_required:
    description: "Expect 422 when all required fields are missing"
    endpoint: /api/v1/check-order
    expect_status: 422
    requests: [missing_all_required]
    assertions:
      - query: "$[detail]?"
        expect: true
        message: "Error response should contain detail field"
      - query: "$[detail].length()"
        expect_gte: 3
        message: "Should have at least 3 validation errors (name, email, ip, user_agent)"

  error_empty_body:
    description: "Expect 422 when body is empty"
    endpoint: /api/v1/check-order
    expect_status: 422
    requests: [empty_body]
    assertions:
      - query: "$[detail]?"
        expect: true
        message: "Error response should contain detail field"
      - query: "$[detail].length()"
        expect_gte: 4
        message: "Should have 4 validation errors for all required fields"

  error_response_structure:
    description: "Verify validation error response structure"
    endpoint: /api/v1/check-order
    expect_status: 422
    requests: [missing_email]
    assertions:
      - query: "$[detail][0][type]?"
        expect: true
        message: "Validation error should have type field"
      - query: "$[detail][0][loc]?"
        expect: true
        message: "Validation error should have loc field"
      - query: "$[detail][0][msg]?"
        expect: true
        message: "Validation error should have msg field"
      - query: "$[detail][0][type]"
        expect: "missing"
        message: "Error type should be 'missing' for missing field"