#[cfg(any(test, feature = "test-support"))]
use crate::mock_client::{ExpectationBuilder, MockClient};
#[cfg(any(test, feature = "test-support"))]
pub trait RedisMockHelpers {
fn expect_list_caches(&mut self, subscription_id: &str) -> ExpectationBuilder<'_>;
fn expect_list_caches_by_resource_group(
&mut self,
subscription_id: &str,
resource_group_name: &str,
) -> ExpectationBuilder<'_>;
fn expect_get_cache(
&mut self,
subscription_id: &str,
resource_group_name: &str,
name: &str,
) -> ExpectationBuilder<'_>;
fn expect_create_cache(
&mut self,
subscription_id: &str,
resource_group_name: &str,
name: &str,
) -> ExpectationBuilder<'_>;
fn expect_delete_cache(
&mut self,
subscription_id: &str,
resource_group_name: &str,
name: &str,
) -> ExpectationBuilder<'_>;
fn expect_list_keys(
&mut self,
subscription_id: &str,
resource_group_name: &str,
name: &str,
) -> ExpectationBuilder<'_>;
fn expect_regenerate_key(
&mut self,
subscription_id: &str,
resource_group_name: &str,
name: &str,
) -> ExpectationBuilder<'_>;
fn expect_force_reboot(
&mut self,
subscription_id: &str,
resource_group_name: &str,
name: &str,
) -> ExpectationBuilder<'_>;
fn expect_import_data(
&mut self,
subscription_id: &str,
resource_group_name: &str,
name: &str,
) -> ExpectationBuilder<'_>;
fn expect_export_data(
&mut self,
subscription_id: &str,
resource_group_name: &str,
name: &str,
) -> ExpectationBuilder<'_>;
}
#[cfg(any(test, feature = "test-support"))]
impl RedisMockHelpers for MockClient {
fn expect_list_caches(
&mut self,
subscription_id: &str,
) -> crate::mock_client::ExpectationBuilder<'_> {
let path = format!("/subscriptions/{subscription_id}/providers/Microsoft.Cache/redis");
self.expect_get(&path)
}
fn expect_list_caches_by_resource_group(
&mut self,
subscription_id: &str,
resource_group_name: &str,
) -> crate::mock_client::ExpectationBuilder<'_> {
let path = format!(
"/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Cache/redis"
);
self.expect_get(&path)
}
fn expect_get_cache(
&mut self,
subscription_id: &str,
resource_group_name: &str,
name: &str,
) -> crate::mock_client::ExpectationBuilder<'_> {
let path = format!(
"/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Cache/redis/{name}"
);
self.expect_get(&path)
}
fn expect_create_cache(
&mut self,
subscription_id: &str,
resource_group_name: &str,
name: &str,
) -> crate::mock_client::ExpectationBuilder<'_> {
let path = format!(
"/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Cache/redis/{name}"
);
self.expect_put(&path)
}
fn expect_delete_cache(
&mut self,
subscription_id: &str,
resource_group_name: &str,
name: &str,
) -> crate::mock_client::ExpectationBuilder<'_> {
let path = format!(
"/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Cache/redis/{name}"
);
self.expect_delete(&path)
}
fn expect_list_keys(
&mut self,
subscription_id: &str,
resource_group_name: &str,
name: &str,
) -> crate::mock_client::ExpectationBuilder<'_> {
let path = format!(
"/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Cache/redis/{name}/listKeys"
);
self.expect_post(&path)
}
fn expect_regenerate_key(
&mut self,
subscription_id: &str,
resource_group_name: &str,
name: &str,
) -> crate::mock_client::ExpectationBuilder<'_> {
let path = format!(
"/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Cache/redis/{name}/regenerateKey"
);
self.expect_post(&path)
}
fn expect_force_reboot(
&mut self,
subscription_id: &str,
resource_group_name: &str,
name: &str,
) -> crate::mock_client::ExpectationBuilder<'_> {
let path = format!(
"/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Cache/redis/{name}/forceReboot"
);
self.expect_post(&path)
}
fn expect_import_data(
&mut self,
subscription_id: &str,
resource_group_name: &str,
name: &str,
) -> crate::mock_client::ExpectationBuilder<'_> {
let path = format!(
"/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Cache/redis/{name}/import"
);
self.expect_post(&path)
}
fn expect_export_data(
&mut self,
subscription_id: &str,
resource_group_name: &str,
name: &str,
) -> crate::mock_client::ExpectationBuilder<'_> {
let path = format!(
"/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Cache/redis/{name}/export"
);
self.expect_post(&path)
}
}