pub struct MockGitHubApi { /* private fields */ }Expand description
The GitHub operations this crate exposes — the interface consumers code against and mock in tests.
Implementations§
Source§impl MockGitHubApi
impl MockGitHubApi
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 MockGitHubApi
impl MockGitHubApi
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_pr_list(&mut self) -> &mut Expectation
pub fn expect_pr_list(&mut self) -> &mut Expectation
Create an Expectation for mocking the pr_list method
Sourcepub fn expect_pr_list_for_branch(&mut self) -> &mut Expectation
pub fn expect_pr_list_for_branch(&mut self) -> &mut Expectation
Create an Expectation for mocking the pr_list_for_branch method
Sourcepub fn expect_pr_view(&mut self) -> &mut Expectation
pub fn expect_pr_view(&mut self) -> &mut Expectation
Create an Expectation for mocking the pr_view 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_pr_create(&mut self) -> &mut Expectation
pub fn expect_pr_create(&mut self) -> &mut Expectation
Create an Expectation for mocking the pr_create method
Sourcepub fn expect_api(&mut self) -> &mut Expectation
pub fn expect_api(&mut self) -> &mut Expectation
Create an Expectation for mocking the api method
Sourcepub fn expect_pr_merge(&mut self) -> &mut Expectation
pub fn expect_pr_merge(&mut self) -> &mut Expectation
Create an Expectation for mocking the pr_merge method
Sourcepub fn expect_pr_ready(&mut self) -> &mut Expectation
pub fn expect_pr_ready(&mut self) -> &mut Expectation
Create an Expectation for mocking the pr_ready method
Sourcepub fn expect_pr_close(&mut self) -> &mut Expectation
pub fn expect_pr_close(&mut self) -> &mut Expectation
Create an Expectation for mocking the pr_close method
Sourcepub fn expect_pr_checks(&mut self) -> &mut Expectation
pub fn expect_pr_checks(&mut self) -> &mut Expectation
Create an Expectation for mocking the pr_checks method
Sourcepub fn expect_pr_review(&mut self) -> &mut Expectation
pub fn expect_pr_review(&mut self) -> &mut Expectation
Create an Expectation for mocking the pr_review method
Sourcepub fn expect_pr_comment(&mut self) -> &mut Expectation
pub fn expect_pr_comment(&mut self) -> &mut Expectation
Create an Expectation for mocking the pr_comment method
Sourcepub fn expect_pr_feedback(&mut self) -> &mut Expectation
pub fn expect_pr_feedback(&mut self) -> &mut Expectation
Create an Expectation for mocking the pr_feedback method
Sourcepub fn expect_run_list(&mut self) -> &mut Expectation
pub fn expect_run_list(&mut self) -> &mut Expectation
Create an Expectation for mocking the run_list method
Sourcepub fn expect_run_view(&mut self) -> &mut Expectation
pub fn expect_run_view(&mut self) -> &mut Expectation
Create an Expectation for mocking the run_view method
Sourcepub fn expect_run_watch(&mut self) -> &mut Expectation
pub fn expect_run_watch(&mut self) -> &mut Expectation
Create an Expectation for mocking the run_watch 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_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_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 MockGitHubApi
impl Debug for MockGitHubApi
Source§impl Default for MockGitHubApi
impl Default for MockGitHubApi
Source§impl GitHubApi for MockGitHubApi
The GitHub operations this crate exposes — the interface consumers code
against and mock in tests.
impl GitHubApi for MockGitHubApi
The GitHub operations this crate exposes — the interface consumers code against and mock in tests.
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 gh <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 GitHubApi::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 GitHub CLI version (gh --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 (gh 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.
Source§fn repo_view<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Repo>> + 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<Repo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
The repository for dir (gh repo view --json …).
Source§fn pr_list<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<PullRequest>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn pr_list<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<PullRequest>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Pull requests for dir (gh pr list --limit 100 --json …). Returns up to
100 open PRs; use run for more.
Source§fn pr_list_for_branch<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
head: &'life2 str,
base: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<PullRequest>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn pr_list_for_branch<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
head: &'life2 str,
base: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<PullRequest>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Pull requests that merge head into base, in any state — open, closed,
or merged (gh pr list --head <head> --base <base> --state all --limit 100 --json …). Each carries its title, URL, and state. Empty when none
match; returns up to 100 (use run for more).
Source§fn pr_view<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
number: u64,
) -> Pin<Box<dyn Future<Output = Result<PullRequest>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn pr_view<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
number: u64,
) -> Pin<Box<dyn Future<Output = Result<PullRequest>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
A single pull request by number (gh pr view <n> --json …).
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,
Issues for dir (gh issue list --limit 100 --json …). Returns up to 100
open issues; use run for more.
Source§fn pr_create<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
spec: PrCreate,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn pr_create<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
spec: PrCreate,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Open a pull request, returning its URL (gh pr create) — see
PrCreate for the title/body and the optional head (source branch;
None = current branch) / base (target; None = repo default).
Source§fn api<'life0, 'life1, 'async_trait>(
&'life0 self,
endpoint: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn api<'life0, 'life1, 'async_trait>(
&'life0 self,
endpoint: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Raw GitHub REST/GraphQL response body (gh api <endpoint>).
Source§fn pr_merge<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
number: u64,
merge: PrMerge,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn pr_merge<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
number: u64,
merge: PrMerge,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Merge a pull request (gh pr merge <n> --merge|--squash|--rebase [--auto] [--delete-branch]) — see PrMerge.
Source§fn pr_ready<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
number: u64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn pr_ready<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
number: u64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Mark a draft pull request as ready for review (gh pr ready <n>).
Source§fn pr_close<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
number: u64,
delete_branch: bool,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn pr_close<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
number: u64,
delete_branch: bool,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Close a pull request without merging (gh pr close <n> [--delete-branch]).
Source§fn pr_checks<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
number: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<CheckRun>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn pr_checks<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
number: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<CheckRun>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
The PR’s checks (gh pr checks <n> --json …). gh signals the overall
outcome through its exit code — 0 all passed, 8 still pending, 1 some
failed — and emits the same JSON either way, so all three return the
parsed list; branch on each entry’s bucket. A PR
with no checks at all yields an empty list (gh’s “no checks reported”
exit). Any other exit (no such PR, auth required, …) errors.
Source§fn pr_review<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
number: u64,
action: ReviewAction,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn pr_review<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
number: u64,
action: ReviewAction,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Submit a review (gh pr review <n> --approve|--request-changes|--comment [--body <body>]) — see ReviewAction (request-changes/comment carry a
required body by construction).
Source§fn pr_comment<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
number: u64,
body: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn pr_comment<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
number: u64,
body: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Add a conversation comment, returning its URL
(gh pr comment <n> --body <body>).
Source§fn pr_feedback<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
number: u64,
) -> Pin<Box<dyn Future<Output = Result<PrFeedback>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn pr_feedback<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
number: u64,
) -> Pin<Box<dyn Future<Output = Result<PrFeedback>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
The PR’s submitted reviews and conversation comments
(gh pr view <n> --json reviews,comments).
Source§fn run_list<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
limit: u64,
branch: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<Vec<WorkflowRun>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn run_list<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
limit: u64,
branch: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<Vec<WorkflowRun>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Recent workflow runs, newest first (gh run list --limit <n> [--branch <b>] --json …). branch is an owned Option<String> to keep
the trait mockall-friendly.
Source§fn run_view<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
id: u64,
) -> Pin<Box<dyn Future<Output = Result<WorkflowRun>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn run_view<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
id: u64,
) -> Pin<Box<dyn Future<Output = Result<WorkflowRun>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
A single workflow run by id (gh run view <id> --json …); the id is
WorkflowRun::database_id.
Source§fn run_watch<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
id: u64,
) -> Pin<Box<dyn Future<Output = Result<WorkflowRun>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn run_watch<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
id: u64,
) -> Pin<Box<dyn Future<Output = Result<WorkflowRun>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Block until the run finishes, then return its final state
(gh run watch <id>, then a run view). Inspect
conclusion for the outcome — exit codes
can’t distinguish a failed run from a cancelled one.
Blocks for the whole run. A client
default_timeout kills the watch when it
elapses (Error::Timeout) — drive this from a client with no (or a
generous) timeout.
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 its URL
(gh issue create --title <title> --body <body>).
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 number, with body/url filled
(gh issue view <n> --json …).
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, newest first (gh release list --limit 100 --json …); body/url
are not fetched here — use release_view.
Returns up to 100 releases; 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 tag, with body/url filled
(gh release view <tag> --json …). gh reports is_latest only from
release_list; here it defaults to false.