fix(deps): update rust crate kxio to v3
All checks were successful
Test / checks (map[name:nightly]) (push) Successful in 3m18s
Test / checks (map[name:stable]) (push) Successful in 4m54s

This commit is contained in:
Renovate Bot 2024-11-20 22:45:37 +00:00 committed by Paul Campbell
parent 5f70e66039
commit 4861299549
4 changed files with 24 additions and 49 deletions

View file

@ -11,7 +11,7 @@ ignore = "0.4"
file-format = { version = "0.26", features = ["reader-txt"] } file-format = { version = "0.26", features = ["reader-txt"] }
kxio = "2.1" kxio = "3.1"
regex = "1.10" regex = "1.10"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }

View file

@ -12,16 +12,12 @@ pub async fn fetch_open_issues<'net, 'fs>(config: &Config<'net, 'fs>) -> Result<
let repo = config.repo(); let repo = config.repo();
let url = format!("{server_url}/api/v1/repos/{repo}/issues?state=open"); let url = format!("{server_url}/api/v1/repos/{repo}/issues?state=open");
let net = config.net(); let net = config.net();
let client = net.client(); let response = net
let request = client.get(url); .get(url)
let request = if let Some(auth_token) = config.auth_token() { .with_option(config.auth_token())
request.header("Authorization", auth_token) .some(|request, auth_token| request.header("Authorization", auth_token))
} else { .send()
request .await?;
};
// .build();
let response = net.send(request).await?;
let issues: HashSet<Issue> = response.json().await?; let issues: HashSet<Issue> = response.json().await?;
Ok(issues) Ok(issues)

View file

@ -5,25 +5,18 @@ use std::collections::HashSet;
use crate::tests::a_config; use crate::tests::a_config;
use kxio::net::{Method, Net, Url}; use kxio::net::{Net, StatusCode};
#[tokio::test] #[tokio::test]
async fn fetch_lists_issues() { async fn fetch_lists_issues() {
//given //given
let mock_net = kxio::net::mock(); let mock_net = kxio::net::mock();
mock_net mock_net
.on(Method::GET) .on()
.url( .get("https://git.kemitix.net/api/v1/repos/kemitix/test/issues?state=open")
Url::parse("https://git.kemitix.net/api/v1/repos/kemitix/test/issues?state=open") .respond(StatusCode::OK)
.expect("parse url"),
)
.respond(
mock_net
.response()
.status(200)
.body(r#"[{"number":13},{"number":64}]"#) .body(r#"[{"number":13},{"number":64}]"#)
.expect("response body"), .expect("response body");
);
let fs = kxio::fs::temp().expect("temp fs"); let fs = kxio::fs::temp().expect("temp fs");
let net = Net::from(mock_net); let net = Net::from(mock_net);
let config = a_config(&net, &fs).expect("config"); let config = a_config(&net, &fs).expect("config");

View file

@ -1,7 +1,7 @@
// //
use super::*; use super::*;
use kxio::net::{Method, Net, Url}; use kxio::net::{Net, StatusCode};
use printer::TestPrinter; use printer::TestPrinter;
#[tokio::test] #[tokio::test]
@ -10,18 +10,11 @@ async fn run_with_some_invalids() /* -> Result<()> */
//given //given
let mock_net = kxio::net::mock(); let mock_net = kxio::net::mock();
mock_net mock_net
.on(Method::GET) .on()
.url( .get("https://git.kemitix.net/api/v1/repos/kemitix/test/issues?state=open")
Url::parse("https://git.kemitix.net/api/v1/repos/kemitix/test/issues?state=open") .respond(StatusCode::OK)
.expect("parse url"),
)
.respond(
mock_net
.response()
.status(200)
.body(r#"[{"number": 13}]"#) .body(r#"[{"number": 13}]"#)
.expect("response body"), .expect("response body");
);
let net = Net::from(mock_net); let net = Net::from(mock_net);
let fs = kxio::fs::temp().expect("temp fs"); let fs = kxio::fs::temp().expect("temp fs");
@ -49,18 +42,11 @@ async fn run_with_no_invalids() {
//given //given
let mock_net = kxio::net::mock(); let mock_net = kxio::net::mock();
mock_net mock_net
.on(Method::GET) .on()
.url( .get("https://git.kemitix.net/api/v1/repos/kemitix/test/issues?state=open")
Url::parse("https://git.kemitix.net/api/v1/repos/kemitix/test/issues?state=open") .respond(StatusCode::OK)
.expect("parse url"),
)
.respond(
mock_net
.response()
.status(200)
.body(r#"[{"number":23},{"number":43}]"#) .body(r#"[{"number":23},{"number":43}]"#)
.expect("response body"), .expect("response body");
);
let net = Net::from(mock_net); let net = Net::from(mock_net);
let fs = kxio::fs::temp().expect("temp fs"); let fs = kxio::fs::temp().expect("temp fs");