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"] }
kxio = "2.1"
kxio = "3.1"
regex = "1.10"
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 url = format!("{server_url}/api/v1/repos/{repo}/issues?state=open");
let net = config.net();
let client = net.client();
let request = client.get(url);
let request = if let Some(auth_token) = config.auth_token() {
request.header("Authorization", auth_token)
} else {
request
};
// .build();
let response = net.send(request).await?;
let response = net
.get(url)
.with_option(config.auth_token())
.some(|request, auth_token| request.header("Authorization", auth_token))
.send()
.await?;
let issues: HashSet<Issue> = response.json().await?;
Ok(issues)

View file

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

View file

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