mirror of
https://github.com/anthonyoteri/dredge.git
synced 2026-06-05 15:26:53 -04:00
Replace async_std::test with tokio::test
This commit is contained in:
+3
-3
@@ -207,7 +207,7 @@ mod tests {
|
|||||||
///
|
///
|
||||||
/// Attempt to parse a valid RFC5988 header value, and ensure that the
|
/// Attempt to parse a valid RFC5988 header value, and ensure that the
|
||||||
/// parsed URL was returned as expected.
|
/// parsed URL was returned as expected.
|
||||||
#[async_std::test]
|
#[tokio::test]
|
||||||
async fn test_parse_rfc5988_valid() {
|
async fn test_parse_rfc5988_valid() {
|
||||||
// Mock a valid RFC5988 header value
|
// Mock a valid RFC5988 header value
|
||||||
let valid_header_value =
|
let valid_header_value =
|
||||||
@@ -225,7 +225,7 @@ mod tests {
|
|||||||
///
|
///
|
||||||
/// Attempt to parse an invalid string as RFC5988, ensuring that the `None`
|
/// Attempt to parse an invalid string as RFC5988, ensuring that the `None`
|
||||||
/// variant is returned.
|
/// variant is returned.
|
||||||
#[async_std::test]
|
#[tokio::test]
|
||||||
async fn test_parse_rfc5988_invalid() {
|
async fn test_parse_rfc5988_invalid() {
|
||||||
// Mock a valid RFC5988 header value
|
// Mock a valid RFC5988 header value
|
||||||
let invalid_header_value = HeaderValue::from_str(r#"invalid 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 digest with the proper headers set. The test then validates that
|
||||||
/// the correct digest is returned and that the mock server had the expected
|
/// the correct digest is returned and that the mock server had the expected
|
||||||
/// interactions.
|
/// interactions.
|
||||||
#[async_std::test]
|
#[tokio::test]
|
||||||
async fn test_get_digest() -> Result<(), ApiError> {
|
async fn test_get_digest() -> Result<(), ApiError> {
|
||||||
let mut server = mockito::Server::new_async().await;
|
let mut server = mockito::Server::new_async().await;
|
||||||
let path = "/v2/foo/manifests/latest";
|
let path = "/v2/foo/manifests/latest";
|
||||||
|
|||||||
+8
-8
@@ -224,7 +224,7 @@ mod tests {
|
|||||||
/// This test spins up a mock server, and makes a request to the catalog
|
/// 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
|
/// endpoint. It checks that the handler both called the request the
|
||||||
/// expected number of times, and did not return an error.
|
/// expected number of times, and did not return an error.
|
||||||
#[async_std::test]
|
#[tokio::test]
|
||||||
async fn test_catalog_handler() {
|
async fn test_catalog_handler() {
|
||||||
let mut server = mockito::Server::new_async().await;
|
let mut server = mockito::Server::new_async().await;
|
||||||
let path = "/v2/_catalog";
|
let path = "/v2/_catalog";
|
||||||
@@ -253,7 +253,7 @@ mod tests {
|
|||||||
/// should follow, resulting in the combined list. It checks that the
|
/// should follow, resulting in the combined list. It checks that the
|
||||||
/// handler both called the request the expected number of times, and did
|
/// handler both called the request the expected number of times, and did
|
||||||
/// not return an error.
|
/// not return an error.
|
||||||
#[async_std::test]
|
#[tokio::test]
|
||||||
async fn test_catalog_handler_with_pagination() {
|
async fn test_catalog_handler_with_pagination() {
|
||||||
let mut server = mockito::Server::new_async().await;
|
let mut server = mockito::Server::new_async().await;
|
||||||
let path = "/v2/_catalog";
|
let path = "/v2/_catalog";
|
||||||
@@ -294,7 +294,7 @@ mod tests {
|
|||||||
/// This test spins up a mock server, and makes a request to the tags
|
/// 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
|
/// endpoint. It checks that the handler both called the request the
|
||||||
/// expected number of times, and did not return an error.
|
/// expected number of times, and did not return an error.
|
||||||
#[async_std::test]
|
#[tokio::test]
|
||||||
async fn test_tags_handler() {
|
async fn test_tags_handler() {
|
||||||
let mut server = mockito::Server::new_async().await;
|
let mut server = mockito::Server::new_async().await;
|
||||||
let path = "/v2/some_image/tags/list";
|
let path = "/v2/some_image/tags/list";
|
||||||
@@ -324,7 +324,7 @@ mod tests {
|
|||||||
/// should follow, resulting in the combined list. It checks that the
|
/// should follow, resulting in the combined list. It checks that the
|
||||||
/// handler both called the request the expected number of times, and did
|
/// handler both called the request the expected number of times, and did
|
||||||
/// not return an error.
|
/// not return an error.
|
||||||
#[async_std::test]
|
#[tokio::test]
|
||||||
async fn test_tags_handler_with_pagination() {
|
async fn test_tags_handler_with_pagination() {
|
||||||
let mut server = mockito::Server::new_async().await;
|
let mut server = mockito::Server::new_async().await;
|
||||||
let path = "/v2/some_image/tags/list";
|
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
|
/// 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
|
/// endpoint. It checks that the handler both called the request the
|
||||||
/// expected number of times, and did not return an error.
|
/// expected number of times, and did not return an error.
|
||||||
#[async_std::test]
|
#[tokio::test]
|
||||||
async fn test_check_handler() {
|
async fn test_check_handler() {
|
||||||
let mut server = mockito::Server::new_async().await;
|
let mut server = mockito::Server::new_async().await;
|
||||||
let path = "/v2";
|
let path = "/v2";
|
||||||
@@ -392,7 +392,7 @@ mod tests {
|
|||||||
///
|
///
|
||||||
/// This validates that if the "Docker-Distribution-API-Version" header
|
/// This validates that if the "Docker-Distribution-API-Version" header
|
||||||
/// is missing in the response, the appropriate error is returned.
|
/// 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<dyn Error>> {
|
async fn test_check_handler_missing_api_version() -> Result<(), Box<dyn Error>> {
|
||||||
let mut server = mockito::Server::new_async().await;
|
let mut server = mockito::Server::new_async().await;
|
||||||
let path = "/v2";
|
let path = "/v2";
|
||||||
@@ -425,7 +425,7 @@ mod tests {
|
|||||||
/// This validates that if the "Docker-Distribution-API-Version" header
|
/// This validates that if the "Docker-Distribution-API-Version" header
|
||||||
/// is present in the response but contains an unexpected value, the
|
/// is present in the response but contains an unexpected value, the
|
||||||
/// appropriate error is returned.
|
/// appropriate error is returned.
|
||||||
#[async_std::test]
|
#[tokio::test]
|
||||||
async fn test_check_handler_invalid_api_version() -> Result<(), Box<dyn Error>> {
|
async fn test_check_handler_invalid_api_version() -> Result<(), Box<dyn Error>> {
|
||||||
let mut server = mockito::Server::new_async().await;
|
let mut server = mockito::Server::new_async().await;
|
||||||
let path = "/v2";
|
let path = "/v2";
|
||||||
@@ -459,7 +459,7 @@ mod tests {
|
|||||||
/// This test spins up a mock server, and makes a request to the image
|
/// 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
|
/// manifests endpoint. It checks that the handler both called the request
|
||||||
/// the expected number of times, and did not return an error.
|
/// the expected number of times, and did not return an error.
|
||||||
#[async_std::test]
|
#[tokio::test]
|
||||||
async fn test_show_handler() {
|
async fn test_show_handler() {
|
||||||
let mut server = mockito::Server::new_async().await;
|
let mut server = mockito::Server::new_async().await;
|
||||||
let path = "/v2/foo/manifests/latest";
|
let path = "/v2/foo/manifests/latest";
|
||||||
|
|||||||
Reference in New Issue
Block a user