Skip to main content

Module test_utils

Module test_utils 

Source
Expand description

Test utilities for database testing.

These functions provide convenient ways to set up test data in the database for integration and unit tests.

§Builder Pattern

For ergonomic test setup, use TestCrateBuilder:

TestCrateBuilder::new(test_db)
    .name("mycrate")
    .owner("admin")
    .version("1.0.0")
    .build()
    .await
    .unwrap();

Structs§

TestCrateBuilder
A builder for creating test crates with a fluent API.

Functions§

add_multiple_versions
Add multiple versions of a crate at once.
clean_db
Clean database by removing old sessions.
default_created
Returns a standard test date for consistent test data.
get_crate_meta_list
Get crate meta list by crate ID.
test_add_cached_crate
Add a cached crate for testing.
test_add_cached_crate_with_downloads
Add a cached crate with a specified download count.
test_add_crate
Add a test crate.
test_add_crate_meta
Add test crate metadata.
test_add_crate_with_downloads
Add a test crate with a specified download count.
test_delete_crate_index
Delete crate index entries for testing.