chore: remove unused token from github tests
This commit is contained in:
parent
7b19f3b66f
commit
c2953adba5
1 changed files with 0 additions and 29 deletions
|
@ -167,18 +167,14 @@ mod github {
|
||||||
let webhook_url = given::any_webhook_url();
|
let webhook_url = given::any_webhook_url();
|
||||||
let hostname = repo_details.forge.hostname();
|
let hostname = repo_details.forge.hostname();
|
||||||
let repo_path = &repo_details.repo_path;
|
let repo_path = &repo_details.repo_path;
|
||||||
use secrecy::ExposeSecret;
|
|
||||||
let token = repo_details.forge.token().expose_secret();
|
|
||||||
let hook_id_1 = given::a_github_webhook_id();
|
let hook_id_1 = given::a_github_webhook_id();
|
||||||
let hook_id_2 = given::a_github_webhook_id();
|
let hook_id_2 = given::a_github_webhook_id();
|
||||||
let hook_id_3 = given::a_github_webhook_id();
|
let hook_id_3 = given::a_github_webhook_id();
|
||||||
let mut net = given::a_network();
|
let mut net = given::a_network();
|
||||||
|
|
||||||
let mut args = with::WebhookArgs {
|
let mut args = with::WebhookArgs {
|
||||||
net: &mut net,
|
net: &mut net,
|
||||||
hostname,
|
hostname,
|
||||||
repo_path,
|
repo_path,
|
||||||
token,
|
|
||||||
};
|
};
|
||||||
// page 1 with three items
|
// page 1 with three items
|
||||||
with::get_webhooks_by_page(
|
with::get_webhooks_by_page(
|
||||||
|
@ -212,7 +208,6 @@ mod github {
|
||||||
let hostname = repo_details.forge.hostname();
|
let hostname = repo_details.forge.hostname();
|
||||||
let repo_path = &repo_details.repo_path;
|
let repo_path = &repo_details.repo_path;
|
||||||
let mut net = given::a_network();
|
let mut net = given::a_network();
|
||||||
|
|
||||||
net.add_get_error(
|
net.add_get_error(
|
||||||
format!("https://api.{hostname}/repos/{repo_path}/hooks?page=1").as_str(),
|
format!("https://api.{hostname}/repos/{repo_path}/hooks?page=1").as_str(),
|
||||||
"error_message",
|
"error_message",
|
||||||
|
@ -236,7 +231,6 @@ mod github {
|
||||||
let repo_path = &repo_details.repo_path;
|
let repo_path = &repo_details.repo_path;
|
||||||
let webhook_id = given::a_webhook_id();
|
let webhook_id = given::a_webhook_id();
|
||||||
let mut net = given::a_network();
|
let mut net = given::a_network();
|
||||||
|
|
||||||
net.add_delete_response(
|
net.add_delete_response(
|
||||||
format!("https://api.{hostname}/repos/{repo_path}/hooks/{webhook_id}").as_str(),
|
format!("https://api.{hostname}/repos/{repo_path}/hooks/{webhook_id}").as_str(),
|
||||||
StatusCode::OK,
|
StatusCode::OK,
|
||||||
|
@ -256,9 +250,7 @@ mod github {
|
||||||
);
|
);
|
||||||
let hostname = repo_details.forge.hostname();
|
let hostname = repo_details.forge.hostname();
|
||||||
let repo_path = &repo_details.repo_path;
|
let repo_path = &repo_details.repo_path;
|
||||||
|
|
||||||
let mut net = given::a_network();
|
let mut net = given::a_network();
|
||||||
|
|
||||||
// unregister the webhook will return empty response
|
// unregister the webhook will return empty response
|
||||||
net.add_delete_error(
|
net.add_delete_error(
|
||||||
format!("https://api.{hostname}/repos/{repo_path}/hooks").as_str(),
|
format!("https://api.{hostname}/repos/{repo_path}/hooks").as_str(),
|
||||||
|
@ -296,17 +288,12 @@ mod github {
|
||||||
given::a_webhook_url(repo_details.forge.forge_alias(), &repo_details.repo_alias);
|
given::a_webhook_url(repo_details.forge.forge_alias(), &repo_details.repo_alias);
|
||||||
let hostname = repo_details.forge.hostname();
|
let hostname = repo_details.forge.hostname();
|
||||||
let repo_path = &repo_details.repo_path;
|
let repo_path = &repo_details.repo_path;
|
||||||
use secrecy::ExposeSecret;
|
|
||||||
let token = repo_details.forge.token().expose_secret();
|
|
||||||
|
|
||||||
let mut net = given::a_network();
|
let mut net = given::a_network();
|
||||||
let mut args = with::WebhookArgs {
|
let mut args = with::WebhookArgs {
|
||||||
net: &mut net,
|
net: &mut net,
|
||||||
hostname,
|
hostname,
|
||||||
repo_path,
|
repo_path,
|
||||||
token,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// there are no existing matching webhooks
|
// there are no existing matching webhooks
|
||||||
with::get_webhooks_by_page(1, &[], &mut args);
|
with::get_webhooks_by_page(1, &[], &mut args);
|
||||||
// register the webhook will succeed
|
// register the webhook will succeed
|
||||||
|
@ -358,22 +345,17 @@ mod github {
|
||||||
given::a_webhook_url(repo_details.forge.forge_alias(), &repo_details.repo_alias);
|
given::a_webhook_url(repo_details.forge.forge_alias(), &repo_details.repo_alias);
|
||||||
let hostname = repo_details.forge.hostname();
|
let hostname = repo_details.forge.hostname();
|
||||||
let repo_path = &repo_details.repo_path;
|
let repo_path = &repo_details.repo_path;
|
||||||
use secrecy::ExposeSecret;
|
|
||||||
let token = repo_details.forge.token().expose_secret();
|
|
||||||
|
|
||||||
let mut net = given::a_network();
|
let mut net = given::a_network();
|
||||||
let mut args = with::WebhookArgs {
|
let mut args = with::WebhookArgs {
|
||||||
net: &mut net,
|
net: &mut net,
|
||||||
hostname,
|
hostname,
|
||||||
repo_path,
|
repo_path,
|
||||||
token,
|
|
||||||
};
|
};
|
||||||
let hook1 = with::ReturnedWebhook::new(given::a_github_webhook_id(), &webhook_url);
|
let hook1 = with::ReturnedWebhook::new(given::a_github_webhook_id(), &webhook_url);
|
||||||
let hook2 = with::ReturnedWebhook::new(given::a_github_webhook_id(), &webhook_url);
|
let hook2 = with::ReturnedWebhook::new(given::a_github_webhook_id(), &webhook_url);
|
||||||
let hook3 =
|
let hook3 =
|
||||||
with::ReturnedWebhook::new(given::a_github_webhook_id(), &given::any_webhook_url());
|
with::ReturnedWebhook::new(given::a_github_webhook_id(), &given::any_webhook_url());
|
||||||
let hooks = [hook1, hook2, hook3];
|
let hooks = [hook1, hook2, hook3];
|
||||||
|
|
||||||
// there are three existing webhooks, two are matching webhooks
|
// there are three existing webhooks, two are matching webhooks
|
||||||
with::get_webhooks_by_page(1, &hooks, &mut args);
|
with::get_webhooks_by_page(1, &hooks, &mut args);
|
||||||
with::get_webhooks_by_page(2, &[], &mut args);
|
with::get_webhooks_by_page(2, &[], &mut args);
|
||||||
|
@ -410,17 +392,12 @@ mod github {
|
||||||
given::a_webhook_url(repo_details.forge.forge_alias(), &repo_details.repo_alias);
|
given::a_webhook_url(repo_details.forge.forge_alias(), &repo_details.repo_alias);
|
||||||
let hostname = repo_details.forge.hostname();
|
let hostname = repo_details.forge.hostname();
|
||||||
let repo_path = &repo_details.repo_path;
|
let repo_path = &repo_details.repo_path;
|
||||||
use secrecy::ExposeSecret;
|
|
||||||
let token = repo_details.forge.token().expose_secret();
|
|
||||||
|
|
||||||
let mut net = given::a_network();
|
let mut net = given::a_network();
|
||||||
let mut args = with::WebhookArgs {
|
let mut args = with::WebhookArgs {
|
||||||
net: &mut net,
|
net: &mut net,
|
||||||
hostname,
|
hostname,
|
||||||
repo_path,
|
repo_path,
|
||||||
token,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// there are no existing matching webhooks
|
// there are no existing matching webhooks
|
||||||
with::get_webhooks_by_page(1, &[], &mut args);
|
with::get_webhooks_by_page(1, &[], &mut args);
|
||||||
// register the webhook will return empty response
|
// register the webhook will return empty response
|
||||||
|
@ -450,17 +427,12 @@ mod github {
|
||||||
given::a_webhook_url(repo_details.forge.forge_alias(), &repo_details.repo_alias);
|
given::a_webhook_url(repo_details.forge.forge_alias(), &repo_details.repo_alias);
|
||||||
let hostname = repo_details.forge.hostname();
|
let hostname = repo_details.forge.hostname();
|
||||||
let repo_path = &repo_details.repo_path;
|
let repo_path = &repo_details.repo_path;
|
||||||
use secrecy::ExposeSecret;
|
|
||||||
let token = repo_details.forge.token().expose_secret();
|
|
||||||
|
|
||||||
let mut net = given::a_network();
|
let mut net = given::a_network();
|
||||||
let mut args = with::WebhookArgs {
|
let mut args = with::WebhookArgs {
|
||||||
net: &mut net,
|
net: &mut net,
|
||||||
hostname,
|
hostname,
|
||||||
repo_path,
|
repo_path,
|
||||||
token,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// there are no existing matching webhooks
|
// there are no existing matching webhooks
|
||||||
with::get_webhooks_by_page(1, &[], &mut args);
|
with::get_webhooks_by_page(1, &[], &mut args);
|
||||||
// register the webhook will return empty response
|
// register the webhook will return empty response
|
||||||
|
@ -514,7 +486,6 @@ mod github {
|
||||||
pub net: &'a mut network::MockNetwork,
|
pub net: &'a mut network::MockNetwork,
|
||||||
pub hostname: &'a Hostname,
|
pub hostname: &'a Hostname,
|
||||||
pub repo_path: &'a RepoPath,
|
pub repo_path: &'a RepoPath,
|
||||||
pub token: &'a str,
|
|
||||||
}
|
}
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
pub struct ReturnedWebhook {
|
pub struct ReturnedWebhook {
|
||||||
|
|
Loading…
Reference in a new issue