Files
igny8/backend/igny8_core/api/tests
IGNY8 VPS (Salman) 7ad06c6227 Refactor keyword handling: Replace 'intent' with 'country' across backend and frontend
- Updated AutomationService to include estimated_word_count.
- Increased stage_1_batch_size from 20 to 50 in AutomationViewSet.
- Changed Keywords model to replace 'intent' property with 'country'.
- Adjusted ClusteringService to allow a maximum of 50 keywords for clustering.
- Modified admin and management commands to remove 'intent' and use 'country' instead.
- Updated serializers to reflect the change from 'intent' to 'country'.
- Adjusted views and filters to use 'country' instead of 'intent'.
- Updated frontend forms, filters, and pages to replace 'intent' with 'country'.
- Added migration to remove 'intent' field and add 'country' field to SeedKeyword model.
2025-12-17 07:37:36 +00:00
..

API Tests

This directory contains comprehensive unit and integration tests for the Unified API Standard v1.0.

Test Structure

Unit Tests

  • test_response.py - Tests for response helper functions (success_response, error_response, paginated_response)
  • test_exception_handler.py - Tests for custom exception handler
  • test_permissions.py - Tests for permission classes
  • test_throttles.py - Tests for rate limiting

Integration Tests

  • test_integration_base.py - Base class with common fixtures
  • test_integration_planner.py - Planner module endpoint tests
  • test_integration_writer.py - Writer module endpoint tests
  • test_integration_system.py - System module endpoint tests
  • test_integration_billing.py - Billing module endpoint tests
  • test_integration_auth.py - Auth module endpoint tests
  • test_integration_errors.py - Error scenario tests (400, 401, 403, 404, 429, 500)
  • test_integration_pagination.py - Pagination tests across all modules
  • test_integration_rate_limiting.py - Rate limiting integration tests

Running Tests

Run All Tests

python manage.py test igny8_core.api.tests --verbosity=2

Run Specific Test File

python manage.py test igny8_core.api.tests.test_response
python manage.py test igny8_core.api.tests.test_integration_planner

Run Specific Test Class

python manage.py test igny8_core.api.tests.test_response.ResponseHelpersTestCase

Run Specific Test Method

python manage.py test igny8_core.api.tests.test_response.ResponseHelpersTestCase.test_success_response_with_data

Test Coverage

Unit Tests Coverage

  • Response helpers (100%)
  • Exception handler (100%)
  • Permissions (100%)
  • Rate limiting (100%)

Integration Tests Coverage

  • Planner module CRUD + AI actions
  • Writer module CRUD + AI actions
  • System module endpoints
  • Billing module endpoints
  • Auth module endpoints
  • Error scenarios (400, 401, 403, 404, 429, 500)
  • Pagination across all modules
  • Rate limiting headers and bypass logic

Test Requirements

All tests verify:

  1. Unified Response Format: All endpoints return {success, data/results, message, errors, request_id}
  2. Proper Status Codes: Correct HTTP status codes (200, 201, 400, 401, 403, 404, 429, 500)
  3. Error Format: Error responses include error, errors, and request_id
  4. Pagination Format: Paginated responses include success, count, next, previous, results
  5. Request ID: All responses include request_id for tracking