diff --git a/crates/forge-forgejo/src/tests.rs b/crates/forge-forgejo/src/tests.rs index 6ad6f7f..cf10a6d 100644 --- a/crates/forge-forgejo/src/tests.rs +++ b/crates/forge-forgejo/src/tests.rs @@ -587,7 +587,6 @@ mod forgejo { } } mod given { - #![allow(dead_code)] use std::collections::HashMap; @@ -727,11 +726,6 @@ mod forgejo { config::WebhookId::new(a_name()) } - pub fn a_github_webhook_id() -> i64 { - use rand::RngCore as _; - rand::thread_rng().next_u32().into() - } - pub fn a_branch_name() -> config::BranchName { config::BranchName::new(a_name()) } @@ -770,21 +764,6 @@ mod forgejo { git::Commit::new(a_commit_sha(), a_commit_message()) } - pub fn a_commit_with_message(message: &git::commit::Message) -> git::Commit { - git::Commit::new(a_commit_sha(), message.to_owned()) - } - - pub fn a_commit_with_sha(sha: &git::commit::Sha) -> git::Commit { - git::Commit::new(sha.to_owned(), a_commit_message()) - } - - pub fn a_commit_with( - sha: &git::commit::Sha, - message: &git::commit::Message, - ) -> git::Commit { - git::Commit::new(sha.to_owned(), message.to_owned()) - } - pub fn a_commit_message() -> git::commit::Message { git::commit::Message::new(a_name()) } @@ -793,14 +772,6 @@ mod forgejo { git::commit::Sha::new(a_name()) } - pub fn a_webhook_push( - sha: &git::commit::Sha, - message: &git::commit::Message, - ) -> config::webhook::Push { - let branch = a_branch_name(); - config::webhook::Push::new(branch, sha.to_string(), message.to_string()) - } - pub fn a_filesystem() -> kxio::fs::FileSystem { kxio::fs::temp().unwrap_or_else(|e| panic!("{}", e)) } diff --git a/crates/git/src/repository/open/mod.rs b/crates/git/src/repository/open/mod.rs index 3fa89f2..a3f080c 100644 --- a/crates/git/src/repository/open/mod.rs +++ b/crates/git/src/repository/open/mod.rs @@ -1,5 +1,4 @@ // -#![allow(dead_code)] #[cfg(test)] mod tests; @@ -56,12 +55,6 @@ pub fn real(gix_repo: gix::Repository) -> OpenRepository { )))) } -#[cfg(not(tarpaulin_include))] // don't test mocks -#[cfg(test)] -pub const fn mock(mock: git::repository::MockOpenRepository) -> OpenRepository { - OpenRepository::Mock(mock) -} - #[cfg(not(tarpaulin_include))] // don't test mocks #[cfg(test)] pub fn test( diff --git a/crates/git/src/repository/open/otest.rs b/crates/git/src/repository/open/otest.rs index 12a4a8a..dc7b466 100644 --- a/crates/git/src/repository/open/otest.rs +++ b/crates/git/src/repository/open/otest.rs @@ -64,8 +64,6 @@ impl OnPush { #[derive(Clone, Debug)] pub struct TestOpenRepository { - gitdir: config::GitDir, - fs: kxio::fs::FileSystem, on_fetch: Vec, fetch_counter: Cell, on_push: Vec, @@ -134,8 +132,6 @@ impl TestOpenRepository { let_assert!(Ok(gix) = gix::init(pathbuf), "git init"); Self::write_origin(gitdir, &fs); Self { - gitdir: gitdir.clone(), - fs, on_fetch, fetch_counter: Cell::new(0), on_push, @@ -153,8 +149,6 @@ impl TestOpenRepository { let_assert!(Ok(gix) = gix::init_bare(pathbuf), "git init bare"); Self::write_origin(gitdir, &fs); Self { - gitdir: gitdir.clone(), - fs, on_fetch, fetch_counter: Cell::new(0), on_push, diff --git a/crates/git/src/tests.rs b/crates/git/src/tests.rs index 4fac7c2..f54c0cb 100644 --- a/crates/git/src/tests.rs +++ b/crates/git/src/tests.rs @@ -210,7 +210,6 @@ mod repo_details { } } pub mod given { - #![allow(dead_code)] use std::path::PathBuf; // @@ -221,28 +220,12 @@ pub mod given { }; use config::{ BranchName, ForgeAlias, ForgeConfig, ForgeType, GitDir, RepoAlias, RepoBranches, - RepoConfig, ServerRepoConfig, WebhookAuth, WebhookId, + RepoConfig, ServerRepoConfig, }; use git_next_config as config; - use rand::RngCore; - use crate::RepoDetails; - pub fn a_webhook_auth() -> WebhookAuth { - WebhookAuth::generate() - } - - pub enum Header { - Valid(WebhookAuth, config::webhook::message::Body), - Missing, - Invalid, - } - - pub fn a_webhook_message_body() -> config::webhook::message::Body { - config::webhook::message::Body::new(a_name()) - } - pub fn repo_branches() -> RepoBranches { RepoBranches::new( format!("main-{}", a_name()), @@ -259,21 +242,6 @@ pub mod given { RepoAlias::new(a_name()) } - pub fn a_network() -> kxio::network::MockNetwork { - kxio::network::MockNetwork::new() - } - - pub fn a_webhook_url( - forge_alias: &ForgeAlias, - repo_alias: &RepoAlias, - ) -> git_next_config::server::WebhookUrl { - config::server::Webhook::new(a_name()).url(forge_alias, repo_alias) - } - - pub fn any_webhook_url() -> git_next_config::server::WebhookUrl { - a_webhook_url(&a_forge_alias(), &a_repo_alias()) - } - pub fn a_pathbuf() -> PathBuf { PathBuf::from(given::a_name()) } @@ -291,14 +259,6 @@ pub mod given { generate(5) } - pub fn a_webhook_id() -> WebhookId { - WebhookId::new(a_name()) - } - - pub fn a_github_webhook_id() -> i64 { - rand::thread_rng().next_u32().into() - } - pub fn a_branch_name() -> BranchName { BranchName::new(a_name()) } @@ -349,10 +309,6 @@ pub mod given { git::Commit::new(sha.to_owned(), a_commit_message()) } - pub fn a_commit_with(sha: &git::commit::Sha, message: &git::commit::Message) -> git::Commit { - git::Commit::new(sha.to_owned(), message.to_owned()) - } - pub fn a_commit_message() -> git::commit::Message { git::commit::Message::new(a_name()) }