Testing
The User Workspaces Server includes comprehensive unit and integration tests to ensure code quality and functionality.
Test Structure
The test suite is organized into two main categories:
Unit Tests:
tests/unittests/- Isolated component testingIntegration Tests:
tests/integrationtests/- End-to-end workflow testing (to be implemented)Controller Tests: Dedicated test modules for each controller type
Test Configuration
Tests use separate configuration files:
tests/test_config.json&tests/test_django_config.json- Local test configurationtests/github_test_config.json&tests/github_test_django_config.json- GitHub Actions configuration
Running Tests
Local Testing
From the src/ directory, run the Django test suite:
Test Types
Unit Tests
- Model Tests (
tests/unittests/test_models.py) Database model validation
Model method functionality
Constraint testing
- View Tests (
tests/unittests/test_views.py) API endpoint testing
Authentication testing
Input validation
Coverage Reporting
Code coverage is tracked using the coverage package:
# Run tests with coverage
coverage run manage.py test tests.unittests --settings=tests.settings
# Generate coverage report
coverage report -m
# Generate HTML coverage report
coverage html