chore: remove dead code
This commit is contained in:
parent
cb1ba07148
commit
2acc43d3d6
4 changed files with 1 additions and 87 deletions
|
@ -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))
|
||||
}
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -64,8 +64,6 @@ impl OnPush {
|
|||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct TestOpenRepository {
|
||||
gitdir: config::GitDir,
|
||||
fs: kxio::fs::FileSystem,
|
||||
on_fetch: Vec<OnFetch>,
|
||||
fetch_counter: Cell<usize>,
|
||||
on_push: Vec<OnPush>,
|
||||
|
@ -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,
|
||||
|
|
|
@ -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())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue