From 64467cf10752667ec793d5b68f0ad1125992d73e Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Mon, 23 Dec 2024 09:44:02 +0000 Subject: [PATCH] chore: upgrade kxio to v5.0 Update tests to use net.assert_no_unused_plans() --- Cargo.toml | 6 +- src/nextcloud/tests/board/create_label.rs | 4 ++ src/nextcloud/tests/board/get.rs | 82 ---------------------- src/nextcloud/tests/board/labels.rs | 4 ++ src/nextcloud/tests/card/add_attachment.rs | 4 ++ src/nextcloud/tests/card/add_label.rs | 4 ++ src/nextcloud/tests/card/create.rs | 4 ++ src/nextcloud/tests/card/get.rs | 4 ++ src/nextcloud/tests/deck/get.rs | 4 ++ src/nextcloud/tests/stack/create.rs | 4 ++ src/nextcloud/tests/stack/get.rs | 4 ++ src/tests/check.rs | 2 + src/trello/tests/attachment/get.rs | 4 ++ src/trello/tests/attachment/save.rs | 2 + src/trello/tests/board/get.rs | 4 ++ src/trello/tests/card/get.rs | 4 ++ src/trello/tests/member/get.rs | 4 ++ src/trello/tests/stack/get.rs | 4 ++ 18 files changed, 63 insertions(+), 85 deletions(-) delete mode 100644 src/nextcloud/tests/board/get.rs diff --git a/Cargo.toml b/Cargo.toml index a4510a0..a8edcff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,10 +16,10 @@ derive_more = { version = "1.0", features = [ ] } inquire = "0.7" kameo = "0.13" -# kxio = {path = "../kxio/"} -kxio = "4.0" +# kxio = { path = "../kxio/" } +kxio = "5.0" rand = "0.8" -reqwest = { version = "0.12" , features = ["multipart", "stream"]} +reqwest = { version = "0.12", features = ["multipart", "stream"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" tokio = { version = "1.41", features = ["full", "tracing"] } diff --git a/src/nextcloud/tests/board/create_label.rs b/src/nextcloud/tests/board/create_label.rs index ff71d45..d589f2b 100644 --- a/src/nextcloud/tests/board/create_label.rs +++ b/src/nextcloud/tests/board/create_label.rs @@ -70,6 +70,8 @@ async fn dump(ctx: FullCtx, board_id: NextcloudBoardId) { output.trim(), include_str!("../../../tests/responses/nextcloud-board-create-label.json").trim() ); + + ctx.net.assert_no_unused_plans(); } #[rstest::rstest] @@ -95,4 +97,6 @@ async fn no_dump(ctx: FullCtx, board_id: NextcloudBoardId) { //then let output = prt.output(); assert_peq!(output.trim(), "2:54:my green label:31CC7C"); + + ctx.net.assert_no_unused_plans(); } diff --git a/src/nextcloud/tests/board/get.rs b/src/nextcloud/tests/board/get.rs deleted file mode 100644 index aa7e87c..0000000 --- a/src/nextcloud/tests/board/get.rs +++ /dev/null @@ -1,82 +0,0 @@ -use crate::execute::Execute; -use crate::nextcloud::board::NextcloudBoardCommand; -use crate::nextcloud::card::NextcloudCardCommand; -use crate::nextcloud::stack::NextcloudStackCommand; -use crate::nextcloud::NextcloudCommand; -use crate::Command; -// -use super::*; - -#[rstest::fixture] -fn board_id() -> NextcloudBoardId { - NextcloudBoardId::new(1) -} - -#[rstest::fixture] -fn ctx() -> FullCtx { - let fs = given::a_filesystem(); - - let nextcloud_config = given::a_nextcloud_config(); - - let hostname = &nextcloud_config.hostname; - let board_id = board_id(); - - let mock_net = given::a_network(); - mock_net - .on() - .get(crate::f!( - "{hostname}/index.php/apps/deck/api/v1.0/boards/{board_id}/stacks", - )) - .respond(StatusCode::OK) - .body(include_str!( - "../../../tests/responses/nextcloud-board-get.json" - )) - .expect("mock request"); - - given::a_full_context(fs, mock_net) -} - -#[rstest::rstest] -#[test_log::test(tokio::test)] -async fn dump(ctx: FullCtx, board_id: NextcloudBoardId) { - //given - let prt = ctx.prt.clone(); - let prt = prt.as_test().unwrap(); - - //when - Command::Nextcloud(NextcloudCommand::Board(NextcloudBoardCommand::Get { - dump: true, - board_id: board_id.into(), - })) - .execute(&ctx) - .await - .expect("execute"); - - //then - let output = prt.output(); - assert_eq!( - output.trim(), - include_str!("../../../tests/responses/nextcloud-board-get.json").trim() - ); -} - -#[rstest::rstest] -#[test_log::test(tokio::test)] -async fn no_dump(ctx: FullCtx, board_id: NextcloudBoardId) { - //given - let prt = ctx.prt.clone(); - let prt = prt.as_test().unwrap(); - - //when - Command::Nextcloud(NextcloudCommand::Board(NextcloudBoardCommand::Get { - dump: false, - board_id: board_id.into(), - })) - .execute(&ctx) - .await - .expect("execute"); - - //then - let output = prt.output(); - assert_eq!(output.trim(), ["2:Doing\n3:Done\n1:To do"].join("\n")); -} diff --git a/src/nextcloud/tests/board/labels.rs b/src/nextcloud/tests/board/labels.rs index d476ae8..e584415 100644 --- a/src/nextcloud/tests/board/labels.rs +++ b/src/nextcloud/tests/board/labels.rs @@ -52,6 +52,8 @@ async fn dump(ctx: FullCtx, board_id: NextcloudBoardId) { output.trim(), include_str!("../../../tests/responses/nextcloud-board-labels.json").trim() ); + + ctx.net.assert_no_unused_plans(); } #[rstest::rstest] @@ -82,4 +84,6 @@ async fn no_dump(ctx: FullCtx, board_id: NextcloudBoardId) { ] .join("\n") ); + + ctx.net.assert_no_unused_plans(); } diff --git a/src/nextcloud/tests/card/add_attachment.rs b/src/nextcloud/tests/card/add_attachment.rs index 327313e..4f532bc 100644 --- a/src/nextcloud/tests/card/add_attachment.rs +++ b/src/nextcloud/tests/card/add_attachment.rs @@ -100,6 +100,8 @@ async fn dump( output.trim(), include_str!("../../../tests/responses/nextcloud-attachment-add.json") ); + + ctx.net.assert_no_unused_plans(); } #[rstest::rstest] @@ -132,4 +134,6 @@ async fn no_dump( //then let output = prt.output(); assert_eq!(output.trim(), "2:1:1:102"); + + ctx.net.assert_no_unused_plans(); } diff --git a/src/nextcloud/tests/card/add_label.rs b/src/nextcloud/tests/card/add_label.rs index 7593f4d..5e77c3c 100644 --- a/src/nextcloud/tests/card/add_label.rs +++ b/src/nextcloud/tests/card/add_label.rs @@ -80,6 +80,8 @@ async fn dump( //then let output = prt.output(); assert_peq!(output.trim(), "null"); + + ctx.net.assert_no_unused_plans(); } #[rstest::rstest] @@ -110,4 +112,6 @@ async fn no_dump( //then let output = prt.output(); assert_eq!(output, ""); + + ctx.net.assert_no_unused_plans(); } diff --git a/src/nextcloud/tests/card/create.rs b/src/nextcloud/tests/card/create.rs index fee09ca..a828926 100644 --- a/src/nextcloud/tests/card/create.rs +++ b/src/nextcloud/tests/card/create.rs @@ -75,6 +75,8 @@ async fn dump( output.trim(), include_str!("../../../tests/responses/nextcloud-card-create.json").trim() ); + + ctx.net.assert_no_unused_plans(); } #[rstest::rstest] @@ -106,4 +108,6 @@ async fn no_dump( //then let output = prt.output(); assert_peq!(output.trim(), "2:1:331:my new card"); + + ctx.net.assert_no_unused_plans(); } diff --git a/src/nextcloud/tests/card/get.rs b/src/nextcloud/tests/card/get.rs index e5569e9..3022915 100644 --- a/src/nextcloud/tests/card/get.rs +++ b/src/nextcloud/tests/card/get.rs @@ -77,6 +77,8 @@ async fn dump( output.trim(), include_str!("../../../tests/responses/nextcloud-card-get.json").trim() ); + + ctx.net.assert_no_unused_plans(); } #[rstest::rstest] @@ -105,4 +107,6 @@ async fn no_dump( //then let output = prt.output(); assert_peq!(output.trim(), "2:1:321:Breakfast: Cereal"); + + ctx.net.assert_no_unused_plans(); } diff --git a/src/nextcloud/tests/deck/get.rs b/src/nextcloud/tests/deck/get.rs index a25a870..69deebf 100644 --- a/src/nextcloud/tests/deck/get.rs +++ b/src/nextcloud/tests/deck/get.rs @@ -52,6 +52,8 @@ async fn dump(ctx: FullCtx) { output.trim(), include_str!("../../../tests/responses/nextcloud-deck-get.json").trim() ); + + ctx.net.assert_no_unused_plans(); } #[rstest::rstest] @@ -80,4 +82,6 @@ async fn no_dump(ctx: FullCtx) { ] .join("\n") ); + + ctx.net.assert_no_unused_plans(); } diff --git a/src/nextcloud/tests/stack/create.rs b/src/nextcloud/tests/stack/create.rs index e1a6230..0e48c89 100644 --- a/src/nextcloud/tests/stack/create.rs +++ b/src/nextcloud/tests/stack/create.rs @@ -63,6 +63,8 @@ async fn dump(ctx: FullCtx, board_id: NextcloudBoardId, stack_title: NextcloudSt output.trim(), include_str!("../../../tests/responses/nextcloud-stack-create.json").trim() ); + + ctx.net.assert_no_unused_plans(); } #[rstest::rstest] @@ -85,4 +87,6 @@ async fn no_dump(ctx: FullCtx, board_id: NextcloudBoardId, stack_title: Nextclou //then let output = prt.output(); assert_peq!(output.trim(), ["1:30:Lunch"].join("\n")); + + ctx.net.assert_no_unused_plans(); } diff --git a/src/nextcloud/tests/stack/get.rs b/src/nextcloud/tests/stack/get.rs index 5cd233b..c8da49f 100644 --- a/src/nextcloud/tests/stack/get.rs +++ b/src/nextcloud/tests/stack/get.rs @@ -63,6 +63,8 @@ async fn dump(ctx: FullCtx, board_id: NextcloudBoardId, stack_id: NextcloudStack output.trim(), include_str!("../../../tests/responses/nextcloud-stack-get.json").trim() ); + + ctx.net.assert_no_unused_plans(); } #[rstest::rstest] @@ -85,4 +87,6 @@ async fn no_dump(ctx: FullCtx, board_id: NextcloudBoardId, stack_id: NextcloudSt //then let output = prt.output(); assert_peq!(output.trim(), ["322:Lunch: Soup & Toast"].join("\n")); + + ctx.net.assert_no_unused_plans(); } diff --git a/src/tests/check.rs b/src/tests/check.rs index 12f7631..92b54b1 100644 --- a/src/tests/check.rs +++ b/src/tests/check.rs @@ -164,5 +164,7 @@ async fn test_run() -> Result<()> { .join("\n") ); + ctx.net.assert_no_unused_plans(); + Ok(()) } diff --git a/src/trello/tests/attachment/get.rs b/src/trello/tests/attachment/get.rs index 0c6f0b0..d719f8b 100644 --- a/src/trello/tests/attachment/get.rs +++ b/src/trello/tests/attachment/get.rs @@ -83,6 +83,8 @@ async fn dump(ctx: FullCtx, card_id: TrelloCardId, attachment_id: TrelloAttachme output.trim(), include_str!("../../../tests/responses/trello-attachment-get.json").trim() ); + + ctx.net.assert_no_unused_plans(); } #[rstest::rstest] @@ -108,4 +110,6 @@ async fn no_dump(ctx: FullCtx, card_id: TrelloCardId, attachment_id: TrelloAttac output.trim(), ["Backlog.png:https://trello.com/1/cards/65ad94865aed24f70ecdcebb/attachments/65ad94875aed24f70ecdd037/download/Backlog.png"].join("\n") ); + + ctx.net.assert_no_unused_plans(); } diff --git a/src/trello/tests/attachment/save.rs b/src/trello/tests/attachment/save.rs index 36a0f7a..64f1d0c 100644 --- a/src/trello/tests/attachment/save.rs +++ b/src/trello/tests/attachment/save.rs @@ -131,4 +131,6 @@ async fn save( data, include_bytes!("../../../tests/responses/trello-attachment-save.png").as_slice() ); + + ctx.net.assert_no_unused_plans(); } diff --git a/src/trello/tests/board/get.rs b/src/trello/tests/board/get.rs index 678d888..536f980 100644 --- a/src/trello/tests/board/get.rs +++ b/src/trello/tests/board/get.rs @@ -67,6 +67,8 @@ async fn dump(ctx: FullCtx, board_id: TrelloBoardId) { output.trim(), include_str!("../../../tests/responses/trello-board-get.json").trim() ); + + ctx.net.assert_no_unused_plans(); } #[rstest::rstest] @@ -96,4 +98,6 @@ async fn no_dump(ctx: FullCtx, board_id: TrelloBoardId) { ] .join("\n") ); + + ctx.net.assert_no_unused_plans(); } diff --git a/src/trello/tests/card/get.rs b/src/trello/tests/card/get.rs index 55edd4a..578909a 100644 --- a/src/trello/tests/card/get.rs +++ b/src/trello/tests/card/get.rs @@ -67,6 +67,8 @@ async fn dump(ctx: FullCtx, card_id: TrelloCardId) { output.trim(), include_str!("../../../tests/responses/trello-card-get.json").trim() ); + + ctx.net.assert_no_unused_plans(); } #[rstest::rstest] @@ -91,4 +93,6 @@ async fn no_dump(ctx: FullCtx, card_id: TrelloCardId) { output.trim(), ["65ad94875aed24f70ecdd037:Backlog.png"].join("\n") ); + + ctx.net.assert_no_unused_plans(); } diff --git a/src/trello/tests/member/get.rs b/src/trello/tests/member/get.rs index 68e7472..a6dac93 100644 --- a/src/trello/tests/member/get.rs +++ b/src/trello/tests/member/get.rs @@ -58,6 +58,8 @@ async fn dump(ctx: FullCtx) { output.trim(), include_str!("../../../tests/responses/trello-member-get.json") ); + + ctx.net.assert_no_unused_plans(); } #[rstest::rstest] @@ -89,4 +91,6 @@ async fn no_dump(ctx: FullCtx) { ] .join("\n") ); + + ctx.net.assert_no_unused_plans(); } diff --git a/src/trello/tests/stack/get.rs b/src/trello/tests/stack/get.rs index afb7ad3..20bf3bb 100644 --- a/src/trello/tests/stack/get.rs +++ b/src/trello/tests/stack/get.rs @@ -69,6 +69,8 @@ async fn dump(ctx: FullCtx, list_id: TrelloListId) { output.trim(), include_str!("../../../tests/responses/trello-stack-get.json").trim() ); + + ctx.net.assert_no_unused_plans(); } #[rstest::rstest] @@ -99,4 +101,6 @@ async fn no_dump(ctx: FullCtx, list_id: TrelloListId) { ] .join("\n") ); + + ctx.net.assert_no_unused_plans(); }