From 42f8f46bd32a87a288c52ba6e8fd438f36c07719 Mon Sep 17 00:00:00 2001 From: Anthony Oteri Date: Mon, 2 Oct 2023 13:10:55 -0400 Subject: [PATCH] Replace async_std::test with tokio::test --- src/api.rs | 6 +++--- src/commands.rs | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/api.rs b/src/api.rs index 9827b0e..599a448 100644 --- a/src/api.rs +++ b/src/api.rs @@ -207,7 +207,7 @@ mod tests { /// /// Attempt to parse a valid RFC5988 header value, and ensure that the /// parsed URL was returned as expected. - #[async_std::test] + #[tokio::test] async fn test_parse_rfc5988_valid() { // Mock a valid RFC5988 header value let valid_header_value = @@ -225,7 +225,7 @@ mod tests { /// /// Attempt to parse an invalid string as RFC5988, ensuring that the `None` /// variant is returned. - #[async_std::test] + #[tokio::test] async fn test_parse_rfc5988_invalid() { // Mock a valid RFC5988 header value let invalid_header_value = HeaderValue::from_str(r#"invalid header value"#) @@ -244,7 +244,7 @@ mod tests { /// the digest with the proper headers set. The test then validates that /// the correct digest is returned and that the mock server had the expected /// interactions. - #[async_std::test] + #[tokio::test] async fn test_get_digest() -> Result<(), ApiError> { let mut server = mockito::Server::new_async().await; let path = "/v2/foo/manifests/latest"; diff --git a/src/commands.rs b/src/commands.rs index 9ad39fb..318f863 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -224,7 +224,7 @@ mod tests { /// This test spins up a mock server, and makes a request to the catalog /// endpoint. It checks that the handler both called the request the /// expected number of times, and did not return an error. - #[async_std::test] + #[tokio::test] async fn test_catalog_handler() { let mut server = mockito::Server::new_async().await; let path = "/v2/_catalog"; @@ -253,7 +253,7 @@ mod tests { /// should follow, resulting in the combined list. It checks that the /// handler both called the request the expected number of times, and did /// not return an error. - #[async_std::test] + #[tokio::test] async fn test_catalog_handler_with_pagination() { let mut server = mockito::Server::new_async().await; let path = "/v2/_catalog"; @@ -294,7 +294,7 @@ mod tests { /// This test spins up a mock server, and makes a request to the tags /// endpoint. It checks that the handler both called the request the /// expected number of times, and did not return an error. - #[async_std::test] + #[tokio::test] async fn test_tags_handler() { let mut server = mockito::Server::new_async().await; let path = "/v2/some_image/tags/list"; @@ -324,7 +324,7 @@ mod tests { /// should follow, resulting in the combined list. It checks that the /// handler both called the request the expected number of times, and did /// not return an error. - #[async_std::test] + #[tokio::test] async fn test_tags_handler_with_pagination() { let mut server = mockito::Server::new_async().await; let path = "/v2/some_image/tags/list"; @@ -366,7 +366,7 @@ mod tests { /// This test spins up a mock server, and makes a request to the check /// endpoint. It checks that the handler both called the request the /// expected number of times, and did not return an error. - #[async_std::test] + #[tokio::test] async fn test_check_handler() { let mut server = mockito::Server::new_async().await; let path = "/v2"; @@ -392,7 +392,7 @@ mod tests { /// /// This validates that if the "Docker-Distribution-API-Version" header /// is missing in the response, the appropriate error is returned. - #[async_std::test] + #[tokio::test] async fn test_check_handler_missing_api_version() -> Result<(), Box> { let mut server = mockito::Server::new_async().await; let path = "/v2"; @@ -425,7 +425,7 @@ mod tests { /// This validates that if the "Docker-Distribution-API-Version" header /// is present in the response but contains an unexpected value, the /// appropriate error is returned. - #[async_std::test] + #[tokio::test] async fn test_check_handler_invalid_api_version() -> Result<(), Box> { let mut server = mockito::Server::new_async().await; let path = "/v2"; @@ -459,7 +459,7 @@ mod tests { /// This test spins up a mock server, and makes a request to the image /// manifests endpoint. It checks that the handler both called the request /// the expected number of times, and did not return an error. - #[async_std::test] + #[tokio::test] async fn test_show_handler() { let mut server = mockito::Server::new_async().await; let path = "/v2/foo/manifests/latest";