diff --git a/Cargo.lock b/Cargo.lock index 53bac37b8d6..f9b25fc2dac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2654,9 +2654,9 @@ dependencies = [ [[package]] name = "googletest" -version = "0.14.1" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc79a6e277a8bc0810e4eb1ce11b0d5a7cbfbdc723d866106f7f5916ab2b7e33" +checksum = "06597b7d02ee58b9a37f522785ac15b9e18c6b178747c4439a6c03fbb35ea753" dependencies = [ "googletest_macro", "num-traits", @@ -2666,9 +2666,9 @@ dependencies = [ [[package]] name = "googletest_macro" -version = "0.14.1" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda3c5a3ab907fa99610e02840457447461e41d819bcb56d525385ea4227c6a8" +checksum = "c31d9f07c9c19b855faebf71637be3b43f8e13a518aece5d61a3beee7710b4ef" dependencies = [ "proc-macro2", "quote", @@ -5515,9 +5515,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.101" +version = "2.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" +checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index ac6d11e71ff..410d018902e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -148,7 +148,7 @@ crates_io_test_db = { path = "crates/crates_io_test_db" } crates_io_trustpub = { path = "crates/crates_io_trustpub", features = ["test-helpers"] } claims = "=0.8.0" diesel = { version = "=2.2.11", features = ["r2d2"] } -googletest = "=0.14.1" +googletest = "=0.14.2" insta = { version = "=1.43.1", features = ["glob", "json", "redactions"] } jsonwebtoken = "=9.3.1" quoted_printable = "=0.5.1" diff --git a/crates/crates_io_database/Cargo.toml b/crates/crates_io_database/Cargo.toml index dc7bbf9cef4..6ba09b8e318 100644 --- a/crates/crates_io_database/Cargo.toml +++ b/crates/crates_io_database/Cargo.toml @@ -31,6 +31,6 @@ utoipa = { version = "=5.4.0", features = ["chrono"] } claims = "=0.8.0" crates_io_test_db = { path = "../crates_io_test_db" } diesel-async = { version = "=0.5.2", features = ["postgres"] } -googletest = "=0.14.1" +googletest = "=0.14.2" insta = "=1.43.1" tokio = { version = "=1.45.1", features = ["macros", "rt"] } diff --git a/src/tests/github_secret_scanning.rs b/src/tests/github_secret_scanning.rs index c3b8b83754a..0054639b4dd 100644 --- a/src/tests/github_secret_scanning.rs +++ b/src/tests/github_secret_scanning.rs @@ -152,7 +152,7 @@ async fn github_secret_alert_revokes_token() { .load(&mut conn) .await ); - assert_that!(tokens, empty()); + assert_that!(tokens, is_empty()); let tokens: Vec = assert_ok!( ApiToken::belonging_to(user.as_model()) @@ -216,7 +216,7 @@ async fn github_secret_alert_for_revoked_token() { .load(&mut conn) .await ); - assert_that!(tokens, empty()); + assert_that!(tokens, is_empty()); let tokens: Vec = assert_ok!( ApiToken::belonging_to(user.as_model()) diff --git a/src/tests/krate/following.rs b/src/tests/krate/following.rs index b7fafe0e2d0..d5c832d5b6b 100644 --- a/src/tests/krate/following.rs +++ b/src/tests/krate/following.rs @@ -91,7 +91,7 @@ async fn test_following() { assert_that!(user.search("").await.crates, len(eq(1))); // see https://github.com/jplatte/serde_html_form/issues/13 assert_that!(user.search("following").await.crates, len(eq(1))); - assert_that!(user.search("following=1").await.crates, empty()); + assert_that!(user.search("following=1").await.crates, is_empty()); // Unfollow the crate again and check that this call is also idempotent. unfollow(CRATE_NAME, &user).await; diff --git a/src/tests/krate/publish/auth.rs b/src/tests/krate/publish/auth.rs index ebb6f42ccc4..c94261e43f7 100644 --- a/src/tests/krate/publish/auth.rs +++ b/src/tests/krate/publish/auth.rs @@ -28,8 +28,8 @@ async fn new_wrong_token() { let response = token.publish_crate(crate_to_publish).await; assert_snapshot!(response.status(), @"403 Forbidden"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"authentication failed"}]}"#); - assert_that!(app.stored_files().await, empty()); - assert_that!(app.emails().await, empty()); + assert_that!(app.stored_files().await, is_empty()); + assert_that!(app.emails().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -51,8 +51,8 @@ async fn new_krate_wrong_user() { assert_snapshot!(response.status(), @"403 Forbidden"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"this crate exists but you don't seem to be an owner. If you believe this is a mistake, perhaps you need to accept an invitation to be an owner before publishing."}]}"#); - assert_that!(app.stored_files().await, empty()); - assert_that!(app.emails().await, empty()); + assert_that!(app.stored_files().await, is_empty()); + assert_that!(app.emails().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] diff --git a/src/tests/krate/publish/basics.rs b/src/tests/krate/publish/basics.rs index d346a82cee4..84a8c6485f8 100644 --- a/src/tests/krate/publish/basics.rs +++ b/src/tests/krate/publish/basics.rs @@ -158,7 +158,7 @@ async fn new_krate_duplicate_version() { assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"crate version `1.0.0` is already uploaded"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] diff --git a/src/tests/krate/publish/categories.rs b/src/tests/krate/publish/categories.rs index d823b89a748..def0dad830e 100644 --- a/src/tests/krate/publish/categories.rs +++ b/src/tests/krate/publish/categories.rs @@ -54,5 +54,5 @@ async fn too_many_categories() { .await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"expected at most 5 categories per crate"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } diff --git a/src/tests/krate/publish/deleted_crates.rs b/src/tests/krate/publish/deleted_crates.rs index faf90aa3157..c3feaadc9e6 100644 --- a/src/tests/krate/publish/deleted_crates.rs +++ b/src/tests/krate/publish/deleted_crates.rs @@ -32,7 +32,7 @@ async fn test_recently_deleted_crate_with_same_name() -> anyhow::Result<()> { let response = token.publish_crate(crate_to_publish).await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"A crate with the name `actix_web` was recently deleted. Reuse of this name will be available after 2099-12-25T12:34:56Z."}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); Ok(()) } diff --git a/src/tests/krate/publish/dependencies.rs b/src/tests/krate/publish/dependencies.rs index 8675e496e46..7e9560bfd31 100644 --- a/src/tests/krate/publish/dependencies.rs +++ b/src/tests/krate/publish/dependencies.rs @@ -12,7 +12,7 @@ async fn invalid_dependency_name() { .await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid character `🦀` in dependency name: `🦀`, the first character must be an ASCII character"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -52,7 +52,7 @@ async fn invalid_dependency_rename() { .await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid character `💩` in dependency name: `💩`, the first character must be an ASCII character, or `_`"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -73,7 +73,7 @@ async fn invalid_dependency_name_starts_with_digit() { .await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"the name `1-foo` cannot be used as a dependency name, the name cannot start with a digit"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -94,7 +94,7 @@ async fn invalid_dependency_name_contains_unicode_chars() { .await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid character `🦀` in dependency name: `foo-🦀-bar`, characters must be an ASCII alphanumeric characters, `-`, or `_`"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -115,7 +115,7 @@ async fn invalid_too_long_dependency_name() { .await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"the dependency name `fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff` is too long (max 64 characters)"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -136,7 +136,7 @@ async fn empty_dependency_name() { .await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"dependency name cannot be empty"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -212,7 +212,7 @@ async fn new_krate_with_broken_dependency_requirement() { let response = token.publish_crate(crate_to_publish).await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"\"broken\" is an invalid version requirement"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -232,7 +232,7 @@ async fn reject_new_krate_with_non_exact_dependency() { let response = token.publish_crate(crate_to_publish).await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"no known crate named `foo_dep`"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -261,7 +261,7 @@ async fn reject_new_crate_with_alternative_registry_dependency() { let response = token.publish_crate(crate_to_publish).await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"Dependency `dep` is hosted on another registry. Cross-registry dependencies are not permitted on crates.io."}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -281,7 +281,7 @@ async fn new_krate_with_wildcard_dependency() { let response = token.publish_crate(crate_to_publish).await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"wildcard (`*`) dependency constraints are not allowed on crates.io. Crate with this problem: `foo_wild` See https://doc.rust-lang.org/cargo/faq.html#can-libraries-use--as-a-version-for-their-dependencies for more information"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -313,7 +313,7 @@ async fn new_krate_with_patch() { let response = token.publish_crate(crate_to_publish).await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"failed to parse `Cargo.toml` manifest file\n\ncrates cannot be published with `[patch]` tables"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -328,7 +328,7 @@ async fn new_krate_dependency_missing() { let response = token.publish_crate(crate_to_publish).await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"no known crate named `bar_missing`"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -369,7 +369,7 @@ async fn invalid_feature_name() { .await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid character `🍺` in feature `🍺`, the first character must be a Unicode XID start character or digit (most letters or `_` or `0` to `9`)"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] diff --git a/src/tests/krate/publish/emails.rs b/src/tests/krate/publish/emails.rs index 1b85e4742f1..bdcc7093b50 100644 --- a/src/tests/krate/publish/emails.rs +++ b/src/tests/krate/publish/emails.rs @@ -19,8 +19,8 @@ async fn new_krate_without_any_email_fails() { let response = token.publish_crate(crate_to_publish).await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"A verified email address is required to publish crates to crates.io. Visit https://crates.io/settings/profile to set and verify your email address."}]}"#); - assert_that!(app.stored_files().await, empty()); - assert_that!(app.emails().await, empty()); + assert_that!(app.stored_files().await, is_empty()); + assert_that!(app.emails().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -39,6 +39,6 @@ async fn new_krate_with_unverified_email_fails() { let response = token.publish_crate(crate_to_publish).await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"A verified email address is required to publish crates to crates.io. Visit https://crates.io/settings/profile to set and verify your email address."}]}"#); - assert_that!(app.stored_files().await, empty()); - assert_that!(app.emails().await, empty()); + assert_that!(app.stored_files().await, is_empty()); + assert_that!(app.emails().await, is_empty()); } diff --git a/src/tests/krate/publish/features.rs b/src/tests/krate/publish/features.rs index 860d76d6e47..509bb4509b9 100644 --- a/src/tests/krate/publish/features.rs +++ b/src/tests/krate/publish/features.rs @@ -72,7 +72,7 @@ async fn invalid_feature_name1() { let response = token.publish_crate(crate_to_publish).await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid character `~` in feature `~foo`, the first character must be a Unicode XID start character or digit (most letters or `_` or `0` to `9`)"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -83,7 +83,7 @@ async fn invalid_feature_name2() { let response = token.publish_crate(crate_to_publish).await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid character `!` in feature `!bar`, the first character must be a Unicode XID start character or digit (most letters or `_` or `0` to `9`)"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -114,7 +114,7 @@ async fn too_many_features() { let response = token.publish_crate(publish_builder).await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"crates.io only allows a maximum number of 3 features, but your crate is declaring 5 features.\n\nTake a look at https://blog.rust-lang.org/2023/10/26/broken-badges-and-23k-keywords.html to understand why this restriction was introduced.\n\nIf you have a use case that requires an increase of this limit, please send us an email to help@crates.io to discuss the details."}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -142,7 +142,7 @@ async fn too_many_features_with_custom_limit() { let response = token.publish_crate(publish_builder).await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"crates.io only allows a maximum number of 4 features, but your crate is declaring 5 features.\n\nTake a look at https://blog.rust-lang.org/2023/10/26/broken-badges-and-23k-keywords.html to understand why this restriction was introduced.\n\nIf you have a use case that requires an increase of this limit, please send us an email to help@crates.io to discuss the details."}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); let publish_builder = PublishBuilder::new("foo", "1.0.0") .feature("one", &[]) @@ -174,7 +174,7 @@ async fn too_many_enabled_features() { let response = token.publish_crate(publish_builder).await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"crates.io only allows a maximum number of 3 features or dependencies that another feature can enable, but the \"default\" feature of your crate is enabling 5 features or dependencies.\n\nTake a look at https://blog.rust-lang.org/2023/10/26/broken-badges-and-23k-keywords.html to understand why this restriction was introduced.\n\nIf you have a use case that requires an increase of this limit, please send us an email to help@crates.io to discuss the details."}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -198,7 +198,7 @@ async fn too_many_enabled_features_with_custom_limit() { let response = token.publish_crate(publish_builder).await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"crates.io only allows a maximum number of 4 features or dependencies that another feature can enable, but the \"default\" feature of your crate is enabling 5 features or dependencies.\n\nTake a look at https://blog.rust-lang.org/2023/10/26/broken-badges-and-23k-keywords.html to understand why this restriction was introduced.\n\nIf you have a use case that requires an increase of this limit, please send us an email to help@crates.io to discuss the details."}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); let publish_builder = PublishBuilder::new("foo", "1.0.0").feature("default", &["one", "two", "three", "four"]); diff --git a/src/tests/krate/publish/keywords.rs b/src/tests/krate/publish/keywords.rs index 5b85d45223d..c16c76c0069 100644 --- a/src/tests/krate/publish/keywords.rs +++ b/src/tests/krate/publish/keywords.rs @@ -54,5 +54,5 @@ async fn too_many_keywords() { .await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"expected at most 5 keywords per crate"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } diff --git a/src/tests/krate/publish/max_size.rs b/src/tests/krate/publish/max_size.rs index af1af94ef7e..4f18d839135 100644 --- a/src/tests/krate/publish/max_size.rs +++ b/src/tests/krate/publish/max_size.rs @@ -91,7 +91,7 @@ async fn tarball_bigger_than_max_upload_size() { let response = token.publish_crate(body).await; assert_snapshot!(response.status(), @"413 Payload Too Large"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"max upload size is: 5242880"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -110,7 +110,7 @@ async fn new_krate_gzip_bomb() { let response = token.publish_crate(crate_to_publish).await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"uploaded tarball is malformed or too large when decompressed"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -129,7 +129,7 @@ async fn new_krate_too_big() { let response = user.publish_crate(builder).await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"uploaded tarball is malformed or too large when decompressed"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] diff --git a/src/tests/krate/publish/similar_names.rs b/src/tests/krate/publish/similar_names.rs index 1094ee1ee9d..6368c915f41 100644 --- a/src/tests/krate/publish/similar_names.rs +++ b/src/tests/krate/publish/similar_names.rs @@ -17,7 +17,7 @@ async fn new_crate_similar_name() { let response = token.publish_crate(crate_to_publish).await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"crate was previously named `Foo_similar`"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -34,7 +34,7 @@ async fn new_crate_similar_name_hyphen() { let response = token.publish_crate(crate_to_publish).await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"crate was previously named `foo_bar_hyphen`"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -51,5 +51,5 @@ async fn new_crate_similar_name_underscore() { let response = token.publish_crate(crate_to_publish).await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"crate was previously named `foo-bar-underscore`"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } diff --git a/src/tests/krate/publish/tarball.rs b/src/tests/krate/publish/tarball.rs index 39aeaee00d6..c80ef300abb 100644 --- a/src/tests/krate/publish/tarball.rs +++ b/src/tests/krate/publish/tarball.rs @@ -16,7 +16,7 @@ async fn new_krate_wrong_files() { let response = user.publish_crate(builder).await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid path found: bar-1.0.0/a"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -43,7 +43,7 @@ async fn new_krate_tarball_with_hard_links() { let response = token.publish_crate(body).await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"unexpected symlink or hard link found: foo-1.1.0/bar"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -53,7 +53,7 @@ async fn empty_body() { let response = user.publish_crate(&[] as &[u8]).await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid metadata length"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -63,7 +63,7 @@ async fn json_len_truncated() { let response = token.publish_crate(&[0u8, 0] as &[u8]).await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid metadata length"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -73,7 +73,7 @@ async fn json_bytes_truncated() { let response = token.publish_crate(&[100u8, 0, 0, 0, 0] as &[u8]).await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid metadata length for remaining payload: 100"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -92,7 +92,7 @@ async fn tarball_len_truncated() { assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid tarball length"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -110,5 +110,5 @@ async fn tarball_bytes_truncated() { let response = token.publish_crate(bytes.freeze()).await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid tarball length for remaining payload: 100"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } diff --git a/src/tests/krate/publish/validation.rs b/src/tests/krate/publish/validation.rs index e316bc3cec3..dfee13784c8 100644 --- a/src/tests/krate/publish/validation.rs +++ b/src/tests/krate/publish/validation.rs @@ -15,7 +15,7 @@ async fn empty_json() { let response = token.publish_crate(body).await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid upload request: missing field `name` at line 1 column 2"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -41,7 +41,7 @@ async fn invalid_names() { bad_name("compiler_rt", &token).await; bad_name("coMpiLer_Rt", &token).await; - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -56,7 +56,7 @@ async fn invalid_version() { let response = token.publish_crate(body).await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"\"broken\" is an invalid semver version"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -83,7 +83,7 @@ async fn license_and_description_required() { let response = token.publish_crate(crate_to_publish).await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"missing or empty metadata fields: description. Please see https://doc.rust-lang.org/cargo/reference/manifest.html for more information on configuring these fields"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -97,7 +97,7 @@ async fn long_description() { assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"The `description` is too long. A maximum of 1000 characters are currently allowed."}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -109,7 +109,7 @@ async fn invalid_license() { .await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"unknown or invalid license expression; see http://opensource.org/licenses for options, and http://spdx.org/licenses/ for their identifiers\nNote: If you have a non-standard license that is not listed by SPDX, use the license-file field to specify the path to a file containing the text of the license.\nSee https://doc.rust-lang.org/cargo/reference/manifest.html#the-license-and-license-file-fields for more information.\nMIT AND foobar\n ^^^^^^ unknown term"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } #[tokio::test(flavor = "multi_thread")] @@ -123,5 +123,5 @@ async fn invalid_urls() { .await; assert_snapshot!(response.status(), @"400 Bad Request"); assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"URL for field `documentation` must begin with http:// or https:// (url: javascript:alert('boom'))"}]}"#); - assert_that!(app.stored_files().await, empty()); + assert_that!(app.stored_files().await, is_empty()); } diff --git a/src/tests/routes/crates/list.rs b/src/tests/routes/crates/list.rs index 8bb21f55ddb..073318fb594 100644 --- a/src/tests/routes/crates/list.rs +++ b/src/tests/routes/crates/list.rs @@ -1073,7 +1073,7 @@ async fn seek_based_pagination() -> anyhow::Result<()> { assert_eq!(resp.meta.total, 3); assert!(default_versions_iter(&resp.crates).all(Option::is_some)); } else { - assert_that!(resp.crates, empty()); + assert_that!(resp.crates, is_empty()); assert_eq!(resp.meta.total, 0); } @@ -1269,7 +1269,7 @@ async fn page_with_seek( assert_ne!(resp.meta.total, 0); assert!(default_versions_iter(&resp.crates).all(Option::is_some)); } else { - assert_that!(resp.crates, empty()); + assert_that!(resp.crates, is_empty()); assert_eq!(resp.meta.total, 0); } results.push(resp); diff --git a/src/tests/routes/crates/versions/list.rs b/src/tests/routes/crates/versions/list.rs index 4ce3867c536..d5665f03102 100644 --- a/src/tests/routes/crates/versions/list.rs +++ b/src/tests/routes/crates/versions/list.rs @@ -464,7 +464,7 @@ async fn page_with_seek(anon: &U, url: &str) -> (Vec("/api/v1/crates/foo_fighters/follow", b"" as &[u8]) @@ -96,7 +96,7 @@ async fn following() { .get_with_query("/api/v1/me/updates", "page=2&per_page=1") .await .good(); - assert_that!(r.versions, empty()); + assert_that!(r.versions, is_empty()); assert!(!r.meta.more); let response = user diff --git a/src/typosquat/checks.rs b/src/typosquat/checks.rs index f382591e006..dea6ad1dfb2 100644 --- a/src/typosquat/checks.rs +++ b/src/typosquat/checks.rs @@ -118,7 +118,7 @@ mod tests { { let name = package.name.clone(); let squats = harness.check_package(&name, Box::new(package))?; - assert_that!(squats, empty()); + assert_that!(squats, is_empty()); } // Now try some packages that should be. @@ -133,7 +133,7 @@ mod tests { { let name = package.name.clone(); let squats = harness.check_package(&name, Box::new(package))?; - assert_that!(squats, not(empty())); + assert_that!(squats, not(is_empty())); } Ok(())