| Crates.io | reinhardt-test |
| lib.rs | reinhardt-test |
| version | 0.1.0-alpha.1 |
| created_at | 2026-01-23 10:19:38.574613+00 |
| updated_at | 2026-01-23 10:19:38.574613+00 |
| description | Testing utilities and helpers for Reinhardt framework |
| homepage | |
| repository | https://github.com/kent8192/reinhardt-rs |
| max_upload_size | |
| id | 2064045 |
| size | 895,237 |
Testing utilities and test client for the Reinhardt framework
Comprehensive testing utilities inspired by Django REST Framework's test utilities. This crate provides reusable testing tools including APIClient for making test requests, test case base classes, database fixtures, mock utilities, and TestContainers integration for infrastructure testing.
Supports both unit testing and integration testing with real or test databases.
Add reinhardt to your Cargo.toml:
[dependencies]
reinhardt = { version = "0.1.0-alpha.1", features = ["test"] }
# Or use a preset:
# reinhardt = { version = "0.1.0-alpha.1", features = ["standard"] } # Recommended
# reinhardt = { version = "0.1.0-alpha.1", features = ["full"] } # All features
Then import testing features:
use reinhardt::test::{APIClient, APITestCase, TestResponse};
use reinhardt::test::{FixtureLoader, Factory, MockFunction};
Note: Testing features are included in the standard and full feature presets.
assert_ok(), assert_created(), assert_not_found(), etc.assert_success(), assert_client_error(), assert_server_error()test_case!: Standard test case definitionauthenticated_test_case!: Pre-authenticated test casestest_case_with_db!: Database-backed test cases (requires testcontainers feature)Factory<T> trait for creating test objectsFactoryBuilder: Simple factory implementationwas_called(), was_called_with()assert_message_count(): Verify message countassert_message_exists(): Check for specific messagesassert_message_level(): Verify message levelsassert_message_tags(): Check message tagsassert_messages(): Ordered and unordered message verificationassert_json_field_eq(): Field value equalityassert_json_has_field(): Field presenceassert_json_missing_field(): Field absenceassert_json_array_len(): Array length verificationassert_json_array_empty() / assert_json_array_not_empty(): Empty state checksassert_json_array_contains(): Element presenceassert_json_matches(): Subset matching for complex structuresassert_status_eq(): Exact status code matchingassert_status_success(): 2xx range verificationassert_status_client_error(): 4xx range verificationassert_status_server_error(): 5xx range verificationassert_status_redirect(): 3xx range verificationassert_status_error(): 4xx or 5xx verificationassert_contains(): Text substring presenceassert_not_contains(): Text substring absencetestcontainers feature)PostgresContainer: PostgreSQL test container with custom credentialsMySqlContainer: MySQL test container with custom credentialsRedisContainer: Redis test containerwith_postgres(): Run tests with PostgreSQL containerwith_mysql(): Run tests with MySQL containerwith_redis(): Run tests with Redis container