pub struct GitScenarioMock { /* private fields */ }Expand description
Scenario-based mock for git operations
Implementations§
Source§impl GitScenarioMock
impl GitScenarioMock
Sourcepub async fn set_scenario(&self, path: &Path, scenario: GitScenario)
pub async fn set_scenario(&self, path: &Path, scenario: GitScenario)
Configure scenario for a specific path
Sourcepub async fn with_clean_repo(&mut self, path: &Path)
pub async fn with_clean_repo(&mut self, path: &Path)
Create a clean repository scenario
Sourcepub async fn with_dirty_repo(&mut self, path: &Path)
pub async fn with_dirty_repo(&mut self, path: &Path)
Create a dirty repository scenario
Sourcepub async fn with_merge_conflict(&mut self, path: &Path)
pub async fn with_merge_conflict(&mut self, path: &Path)
Create a merge conflict scenario
Sourcepub async fn with_detached_head(&mut self, path: &Path)
pub async fn with_detached_head(&mut self, path: &Path)
Create a detached HEAD scenario
Sourcepub async fn with_non_repository(&mut self, path: &Path)
pub async fn with_non_repository(&mut self, path: &Path)
Create a non-repository scenario
Sourcepub async fn when_command(
&mut self,
path: &Path,
command: &str,
response: ScenarioResponse,
)
pub async fn when_command( &mut self, path: &Path, command: &str, response: ScenarioResponse, )
Add a custom response for a specific command
Sourcepub async fn get_command_log(&self) -> Vec<GitCommand>
pub async fn get_command_log(&self) -> Vec<GitCommand>
Get logged commands for verification
Sourcepub async fn clear_command_log(&self)
pub async fn clear_command_log(&self)
Clear command log
Trait Implementations§
Source§impl Default for GitScenarioMock
impl Default for GitScenarioMock
Source§impl GitReader for GitScenarioMock
impl GitReader for GitScenarioMock
Source§fn is_repository<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = LibResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn is_repository<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = LibResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if a directory is a git repository
Source§fn get_status<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = LibResult<GitStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_status<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = LibResult<GitStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get git status for the repository
Source§fn get_current_branch<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = LibResult<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_current_branch<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = LibResult<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get the current branch name
Source§fn get_commit_message<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 Path,
ref_: &'life2 str,
) -> Pin<Box<dyn Future<Output = LibResult<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_commit_message<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 Path,
ref_: &'life2 str,
) -> Pin<Box<dyn Future<Output = LibResult<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Get commit message by reference
Source§fn list_files<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = LibResult<Vec<PathBuf>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_files<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = LibResult<Vec<PathBuf>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List all files tracked by git
Source§fn get_diff<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
path: &'life1 Path,
from: &'life2 str,
to: &'life3 str,
) -> Pin<Box<dyn Future<Output = LibResult<GitDiff>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn get_diff<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
path: &'life1 Path,
from: &'life2 str,
to: &'life3 str,
) -> Pin<Box<dyn Future<Output = LibResult<GitDiff>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Get diff between two references
Source§impl GitWorktree for GitScenarioMock
impl GitWorktree for GitScenarioMock
Source§fn create_worktree<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
repo: &'life1 Path,
name: &'life2 str,
path: &'life3 Path,
) -> Pin<Box<dyn Future<Output = LibResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn create_worktree<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
repo: &'life1 Path,
name: &'life2 str,
path: &'life3 Path,
) -> Pin<Box<dyn Future<Output = LibResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Create a new worktree
Source§fn remove_worktree<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
repo: &'life1 Path,
name: &'life2 str,
) -> Pin<Box<dyn Future<Output = LibResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn remove_worktree<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
repo: &'life1 Path,
name: &'life2 str,
) -> Pin<Box<dyn Future<Output = LibResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Remove a worktree
Source§impl GitWriter for GitScenarioMock
impl GitWriter for GitScenarioMock
Source§fn init_repository<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = LibResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn init_repository<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = LibResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Initialize a new git repository
Source§fn stage_files<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 Path,
files: &'life2 [PathBuf],
) -> Pin<Box<dyn Future<Output = LibResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn stage_files<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 Path,
files: &'life2 [PathBuf],
) -> Pin<Box<dyn Future<Output = LibResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Stage specific files
Source§fn stage_all<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = LibResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn stage_all<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = LibResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Stage all changes
Source§fn commit<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 Path,
message: &'life2 str,
) -> Pin<Box<dyn Future<Output = LibResult<CommitId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn commit<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 Path,
message: &'life2 str,
) -> Pin<Box<dyn Future<Output = LibResult<CommitId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Create a commit with message
Source§fn create_branch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 Path,
name: &'life2 str,
) -> Pin<Box<dyn Future<Output = LibResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn create_branch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 Path,
name: &'life2 str,
) -> Pin<Box<dyn Future<Output = LibResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Create a new branch
Auto Trait Implementations§
impl !RefUnwindSafe for GitScenarioMock
impl !UnwindSafe for GitScenarioMock
impl Freeze for GitScenarioMock
impl Send for GitScenarioMock
impl Sync for GitScenarioMock
impl Unpin for GitScenarioMock
impl UnsafeUnpin for GitScenarioMock
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more