2024-05-23 08:53:16 +01:00
|
|
|
//
|
|
|
|
#![cfg(not(tarpaulin_include))]
|
|
|
|
|
2024-05-25 11:25:13 +01:00
|
|
|
use derive_more::Constructor;
|
|
|
|
use git_next_config as config;
|
2024-05-23 16:19:28 +01:00
|
|
|
use git_next_git as git;
|
2024-05-11 19:46:20 +01:00
|
|
|
|
2024-05-25 11:25:13 +01:00
|
|
|
#[derive(Clone, Debug, Constructor)]
|
|
|
|
pub struct MockForge;
|
|
|
|
|
2024-04-16 22:21:55 +01:00
|
|
|
#[async_trait::async_trait]
|
2024-05-25 11:25:13 +01:00
|
|
|
impl git::ForgeLike for MockForge {
|
|
|
|
fn name(&self) -> String {
|
2024-04-16 22:21:55 +01:00
|
|
|
"mock".to_string()
|
|
|
|
}
|
|
|
|
|
2024-05-25 11:25:13 +01:00
|
|
|
fn is_message_authorised(
|
|
|
|
&self,
|
|
|
|
_msg: &config::WebhookMessage,
|
|
|
|
_expected: &config::WebhookAuth,
|
|
|
|
) -> bool {
|
2024-06-19 07:02:49 +01:00
|
|
|
todo!("MockForge::is_message_authorised")
|
2024-05-25 11:25:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
fn parse_webhook_body(
|
|
|
|
&self,
|
|
|
|
_body: &config::webhook::message::Body,
|
|
|
|
) -> git::forge::webhook::Result<config::webhook::push::Push> {
|
2024-06-19 07:02:49 +01:00
|
|
|
todo!("MockForge::parse_webhook_body")
|
2024-05-25 11:25:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
async fn commit_status(&self, _commit: &git::Commit) -> git::forge::commit::Status {
|
2024-06-19 07:02:49 +01:00
|
|
|
todo!("MockForge::commit_status")
|
2024-05-25 11:25:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
async fn list_webhooks(
|
|
|
|
&self,
|
|
|
|
_webhook_url: &config::server::WebhookUrl,
|
|
|
|
) -> git::forge::webhook::Result<Vec<config::WebhookId>> {
|
2024-06-19 07:02:49 +01:00
|
|
|
todo!("MockForge::list_webhooks")
|
2024-05-25 11:25:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
async fn unregister_webhook(
|
|
|
|
&self,
|
|
|
|
_webhook_id: &config::WebhookId,
|
|
|
|
) -> git::forge::webhook::Result<()> {
|
2024-06-19 07:02:49 +01:00
|
|
|
todo!("MockForge::unregister_webhook")
|
2024-05-25 11:25:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
async fn register_webhook(
|
|
|
|
&self,
|
|
|
|
_webhook_url: &config::server::WebhookUrl,
|
|
|
|
) -> git::forge::webhook::Result<config::RegisteredWebhook> {
|
2024-06-19 07:02:49 +01:00
|
|
|
Ok(config::RegisteredWebhook::new(
|
|
|
|
config::WebhookId::new(""),
|
|
|
|
config::WebhookAuth::new(ulid::Ulid::new()),
|
|
|
|
))
|
2024-04-16 22:21:55 +01:00
|
|
|
}
|
|
|
|
}
|