#[cfg(any(test, feature = "test-support"))]
use crate::mock_client::{ExpectationBuilder, MockClient};
#[cfg(any(test, feature = "test-support"))]
pub trait AcrMockHelpers {
fn expect_list_registries(&mut self, subscription_id: &str) -> ExpectationBuilder<'_>;
fn expect_get_registry(
&mut self,
subscription_id: &str,
resource_group_name: &str,
registry_name: &str,
) -> ExpectationBuilder<'_>;
fn expect_create_registry(
&mut self,
subscription_id: &str,
resource_group_name: &str,
registry_name: &str,
) -> ExpectationBuilder<'_>;
fn expect_delete_registry(
&mut self,
subscription_id: &str,
resource_group_name: &str,
registry_name: &str,
) -> ExpectationBuilder<'_>;
}
#[cfg(any(test, feature = "test-support"))]
impl AcrMockHelpers for MockClient {
fn expect_list_registries(
&mut self,
subscription_id: &str,
) -> crate::mock_client::ExpectationBuilder<'_> {
let path = format!(
"/subscriptions/{subscription_id}/providers/Microsoft.ContainerRegistry/registries"
);
self.expect_get(&path)
}
fn expect_get_registry(
&mut self,
subscription_id: &str,
resource_group_name: &str,
registry_name: &str,
) -> crate::mock_client::ExpectationBuilder<'_> {
let path = format!(
"/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.ContainerRegistry/registries/{registry_name}"
);
self.expect_get(&path)
}
fn expect_create_registry(
&mut self,
subscription_id: &str,
resource_group_name: &str,
registry_name: &str,
) -> crate::mock_client::ExpectationBuilder<'_> {
let path = format!(
"/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.ContainerRegistry/registries/{registry_name}"
);
self.expect_put(&path)
}
fn expect_delete_registry(
&mut self,
subscription_id: &str,
resource_group_name: &str,
registry_name: &str,
) -> crate::mock_client::ExpectationBuilder<'_> {
let path = format!(
"/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.ContainerRegistry/registries/{registry_name}"
);
self.expect_delete(&path)
}
}