1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//! Test utilities for Redis Cloud API consumers
//!
//! This module provides mock server utilities and fixtures for testing code
//! that uses the `redis-cloud` client library. It is only available when the
//! `test-support` feature is enabled.
//!
//! # Features
//!
//! - **MockCloudServer**: A pre-configured mock server that mimics the Redis Cloud API
//! - **Fixtures**: Builder-pattern fixtures for common response types
//! - **Response helpers**: Convenience functions for creating HTTP responses
//!
//! # Quick Start
//!
//! ```rust,ignore
//! use redis_cloud::testing::{MockCloudServer, SubscriptionFixture, responses};
//!
//! #[tokio::test]
//! async fn test_list_subscriptions() {
//! // Start a mock server
//! let server = MockCloudServer::start().await;
//!
//! // Create a fixture for subscription response
//! let subscription = SubscriptionFixture::new(123, "Production")
//! .status("active")
//! .build();
//!
//! // Mock the subscriptions list endpoint
//! server.mock_subscriptions_list(vec![subscription]).await;
//!
//! // Get a pre-configured client pointing to the mock
//! let client = server.client();
//!
//! // Your test code here...
//! }
//! ```
//!
//! # Custom Mocking
//!
//! For scenarios not covered by the convenience methods, you can access
//! the underlying wiremock server directly:
//!
//! ```rust,ignore
//! use redis_cloud::testing::{MockCloudServer, Mock, method, path, ResponseTemplate};
//!
//! #[tokio::test]
//! async fn test_custom_endpoint() {
//! let server = MockCloudServer::start().await;
//!
//! // Mount a custom mock
//! Mock::given(method("GET"))
//! .and(path("/custom-endpoint"))
//! .respond_with(ResponseTemplate::new(200).set_body_json(serde_json::json!({})))
//! .mount(server.inner())
//! .await;
//!
//! let client = server.client();
//! // ...
//! }
//! ```
// Re-export main types
pub use ;
pub use ;
pub use MockCloudServer;
// Re-export wiremock types for custom mocking
pub use ;