pub struct MockGitLabApi { /* private fields */ }Expand description
The GitLab operations this crate exposes — the interface consumers code
against and mock in tests. The lean MR lifecycle; reach unmodelled glab
commands through run.
Implementations§
Source§impl MockGitLabApi
impl MockGitLabApi
Sourcepub fn checkpoint(&mut self)
pub fn checkpoint(&mut self)
Validate that all current expectations for all methods have been satisfied, and discard them.
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new mock object with no expectations.
This method will not be generated if the real struct
already has a new method. However, it will be
generated if the struct implements a trait with a new
method. The trait’s new method can still be called
like <MockX as TraitY>::new
Source§impl MockGitLabApi
impl MockGitLabApi
Sourcepub fn expect_run(&mut self) -> &mut Expectation
pub fn expect_run(&mut self) -> &mut Expectation
Create an Expectation for mocking the run method
Sourcepub fn expect_run_raw(&mut self) -> &mut Expectation
pub fn expect_run_raw(&mut self) -> &mut Expectation
Create an Expectation for mocking the run_raw method
Sourcepub fn expect_version(&mut self) -> &mut Expectation
pub fn expect_version(&mut self) -> &mut Expectation
Create an Expectation for mocking the version method
Sourcepub fn expect_auth_status(&mut self) -> &mut Expectation
pub fn expect_auth_status(&mut self) -> &mut Expectation
Create an Expectation for mocking the auth_status method
Sourcepub fn expect_repo_view(&mut self) -> &mut Expectation
pub fn expect_repo_view(&mut self) -> &mut Expectation
Create an Expectation for mocking the repo_view method
Sourcepub fn expect_mr_list(&mut self) -> &mut Expectation
pub fn expect_mr_list(&mut self) -> &mut Expectation
Create an Expectation for mocking the mr_list method
Sourcepub fn expect_mr_view(&mut self) -> &mut Expectation
pub fn expect_mr_view(&mut self) -> &mut Expectation
Create an Expectation for mocking the mr_view method
Sourcepub fn expect_mr_create(&mut self) -> &mut Expectation
pub fn expect_mr_create(&mut self) -> &mut Expectation
Create an Expectation for mocking the mr_create method
Sourcepub fn expect_mr_merge(&mut self) -> &mut Expectation
pub fn expect_mr_merge(&mut self) -> &mut Expectation
Create an Expectation for mocking the mr_merge method
Sourcepub fn expect_mr_ready(&mut self) -> &mut Expectation
pub fn expect_mr_ready(&mut self) -> &mut Expectation
Create an Expectation for mocking the mr_ready method
Sourcepub fn expect_mr_close(&mut self) -> &mut Expectation
pub fn expect_mr_close(&mut self) -> &mut Expectation
Create an Expectation for mocking the mr_close method
Sourcepub fn expect_mr_checks(&mut self) -> &mut Expectation
pub fn expect_mr_checks(&mut self) -> &mut Expectation
Create an Expectation for mocking the mr_checks method
Sourcepub fn expect_issue_list(&mut self) -> &mut Expectation
pub fn expect_issue_list(&mut self) -> &mut Expectation
Create an Expectation for mocking the issue_list method
Sourcepub fn expect_issue_view(&mut self) -> &mut Expectation
pub fn expect_issue_view(&mut self) -> &mut Expectation
Create an Expectation for mocking the issue_view method
Sourcepub fn expect_issue_create(&mut self) -> &mut Expectation
pub fn expect_issue_create(&mut self) -> &mut Expectation
Create an Expectation for mocking the issue_create method
Sourcepub fn expect_release_list(&mut self) -> &mut Expectation
pub fn expect_release_list(&mut self) -> &mut Expectation
Create an Expectation for mocking the release_list method
Sourcepub fn expect_release_view(&mut self) -> &mut Expectation
pub fn expect_release_view(&mut self) -> &mut Expectation
Create an Expectation for mocking the release_view method
Trait Implementations§
Source§impl Debug for MockGitLabApi
impl Debug for MockGitLabApi
Source§impl Default for MockGitLabApi
impl Default for MockGitLabApi
Source§impl GitLabApi for MockGitLabApi
The GitLab operations this crate exposes — the interface consumers code
against and mock in tests. The lean MR lifecycle; reach unmodelled glab
commands through run.
impl GitLabApi for MockGitLabApi
The GitLab operations this crate exposes — the interface consumers code
against and mock in tests. The lean MR lifecycle; reach unmodelled glab
commands through run.
Source§fn run<'life0, 'life1, 'async_trait>(
&'life0 self,
args: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn run<'life0, 'life1, 'async_trait>(
&'life0 self,
args: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Run glab <args>, returning trimmed stdout (throws on a non-zero exit).
Source§fn run_raw<'life0, 'life1, 'async_trait>(
&'life0 self,
args: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<ProcessResult<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn run_raw<'life0, 'life1, 'async_trait>(
&'life0 self,
args: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<ProcessResult<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Like GitLabApi::run but never errors on a non-zero exit — returns the
captured ProcessResult.
Source§fn version<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn version<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Installed GitLab CLI version (glab --version).
Source§fn auth_status<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn auth_status<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Whether the user is authenticated (glab auth status exits zero). Reflects
the exit code as a bool — any non-zero exit reads as false, never an
error; only a spawn failure or timeout errors.
Caveat: this reflects glab’s exit code, and a long-standing glab bug
(gitlab-org/cli#911) can make glab auth status exit 0 even when not
authenticated, so a true here is a best-effort signal, not a guarantee —
a subsequent API call is the real test. A false, a spawn failure, or a
timeout are still reported faithfully.
Source§fn repo_view<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Project>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn repo_view<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Project>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
The project for dir (glab repo view --output json).
Source§fn mr_list<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<MergeRequest>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn mr_list<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<MergeRequest>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Open merge requests for dir
(glab mr list --per-page 100 --output json). Returns up to 100 (100 is
the GitLab API per-page max); use run for more.
Source§fn mr_view<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
id: u64,
) -> Pin<Box<dyn Future<Output = Result<MergeRequest>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn mr_view<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
id: u64,
) -> Pin<Box<dyn Future<Output = Result<MergeRequest>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
A single merge request by its project-scoped id
(glab mr view <id> --output json).
Source§fn mr_create<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
spec: MrCreate,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn mr_create<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
spec: MrCreate,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Open a merge request, returning the command’s output (the MR URL on
success) (glab mr create). The MrCreate spec carries the title,
body, and the optional source (None = the current branch) and target
(None = the project default) branches.
Source§fn mr_merge<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
id: u64,
strategy: MergeStrategy,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn mr_merge<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
id: u64,
strategy: MergeStrategy,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Merge a merge request immediately (glab mr merge <id> --yes --auto-merge=false [--squash|--rebase]) — --auto-merge=false overrides
glab’s default of enabling merge-when-pipeline-succeeds. See
MergeStrategy.
Source§fn mr_ready<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
id: u64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn mr_ready<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
id: u64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Mark a draft merge request as ready (glab mr update <id> --ready).
Source§fn mr_close<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
id: u64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn mr_close<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
id: u64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Close a merge request without merging (glab mr close <id>).
Source§fn mr_checks<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
id: u64,
) -> Pin<Box<dyn Future<Output = Result<CiStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn mr_checks<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
id: u64,
) -> Pin<Box<dyn Future<Output = Result<CiStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
The MR’s pipeline status, bucketed (glab mr view <id> --output json,
reading head_pipeline.status). CiStatus::None when no pipeline ran.
Source§fn issue_list<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<Issue>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn issue_list<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<Issue>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Open issues for dir
(glab issue list --per-page 100 --output json). Returns up to 100 (100
is the GitLab API per-page max); use run for more.
Source§fn issue_view<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
number: u64,
) -> Pin<Box<dyn Future<Output = Result<Issue>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn issue_view<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
number: u64,
) -> Pin<Box<dyn Future<Output = Result<Issue>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
A single issue by its project-scoped id (iid)
(glab issue view <number> --output json).
Source§fn issue_create<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
title: &'life2 str,
body: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn issue_create<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
title: &'life2 str,
body: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Open an issue, returning the command’s output (the issue URL on success)
(glab issue create --title <t> --description <d> --yes). --yes skips
glab’s interactive submission prompt — mirrors
mr_create.
Source§fn release_list<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<Release>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn release_list<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<Release>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Releases for dir (glab release list --per-page 100 --output json).
Returns up to 100 (100 is the GitLab API per-page max); use
run for more.
Source§fn release_view<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
tag: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Release>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn release_view<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
tag: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Release>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
A single release by its tag (glab release view <tag> --output json).
The tag is a bare positional, so it is guarded with
reject_flag_like (a leading - or empty value is rejected before any
process spawns).