@@ -57,7 +57,7 @@ fn new_wrong_token() {
57
57
// Try to publish without a token
58
58
let crate_to_publish = PublishBuilder :: new ( "foo" ) ;
59
59
let response = anon. enqueue_publish ( crate_to_publish) ;
60
- response. assert_status ( StatusCode :: FORBIDDEN ) ;
60
+ assert_eq ! ( response. status ( ) , StatusCode :: FORBIDDEN ) ;
61
61
assert_eq ! (
62
62
response. json( ) ,
63
63
json!( { "errors" : [ { "detail" : "must be logged in to perform that action" } ] } )
@@ -73,7 +73,7 @@ fn new_wrong_token() {
73
73
74
74
let crate_to_publish = PublishBuilder :: new ( "foo" ) ;
75
75
let response = token. enqueue_publish ( crate_to_publish) ;
76
- response. assert_status ( StatusCode :: FORBIDDEN ) ;
76
+ assert_eq ! ( response. status ( ) , StatusCode :: FORBIDDEN ) ;
77
77
assert_eq ! (
78
78
response. json( ) ,
79
79
json!( { "errors" : [ { "detail" : "must be logged in to perform that action" } ] } )
@@ -232,7 +232,7 @@ fn reject_new_crate_with_alternative_registry_dependency() {
232
232
233
233
let crate_to_publish = PublishBuilder :: new ( "depends-on-alt-registry" ) . dependency ( dependency) ;
234
234
let response = token. enqueue_publish ( crate_to_publish) ;
235
- response. assert_status ( StatusCode :: OK ) ;
235
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
236
236
assert_eq ! (
237
237
response. json( ) ,
238
238
json!( { "errors" : [ { "detail" : "Dependency `dep` is hosted on another registry. Cross-registry dependencies are not permitted on crates.io." } ] } )
@@ -255,7 +255,7 @@ fn new_krate_with_wildcard_dependency() {
255
255
. dependency ( dependency) ;
256
256
257
257
let response = token. enqueue_publish ( crate_to_publish) ;
258
- response. assert_status ( StatusCode :: OK ) ;
258
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
259
259
assert_eq ! (
260
260
response. json( ) ,
261
261
json!( { "errors" : [ { "detail" : WILDCARD_ERROR_MESSAGE } ] } )
@@ -294,7 +294,7 @@ fn new_krate_wrong_user() {
294
294
let crate_to_publish = PublishBuilder :: new ( "foo_wrong" ) . version ( "2.0.0" ) ;
295
295
296
296
let response = another_user. enqueue_publish ( crate_to_publish) ;
297
- response. assert_status ( StatusCode :: OK ) ;
297
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
298
298
assert_eq ! (
299
299
response. json( ) ,
300
300
json!( { "errors" : [ { "detail" : MISSING_RIGHTS_ERROR_MESSAGE } ] } )
@@ -309,7 +309,7 @@ fn new_krate_too_big() {
309
309
let builder = PublishBuilder :: new ( "foo_big" ) . files ( & files) ;
310
310
311
311
let response = user. enqueue_publish ( builder) ;
312
- response. assert_status ( StatusCode :: OK ) ;
312
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
313
313
assert_eq ! (
314
314
response. json( ) ,
315
315
json!( { "errors" : [ { "detail" : "uploaded tarball is malformed or too large when decompressed" } ] } )
@@ -342,7 +342,7 @@ fn new_krate_wrong_files() {
342
342
let builder = PublishBuilder :: new ( "foo" ) . files ( & files) ;
343
343
344
344
let response = user. enqueue_publish ( builder) ;
345
- response. assert_status ( StatusCode :: OK ) ;
345
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
346
346
assert_eq ! (
347
347
response. json( ) ,
348
348
json!( { "errors" : [ { "detail" : "invalid tarball uploaded" } ] } )
@@ -361,7 +361,7 @@ fn new_krate_gzip_bomb() {
361
361
. files_with_io ( & mut [ ( "foo-1.1.0/a" , & mut body, len) ] ) ;
362
362
363
363
let response = token. enqueue_publish ( crate_to_publish) ;
364
- response. assert_status ( StatusCode :: OK ) ;
364
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
365
365
assert_eq ! (
366
366
response. json( ) ,
367
367
json!( { "errors" : [ { "detail" : "uploaded tarball is malformed or too large when decompressed" } ] } )
@@ -381,7 +381,7 @@ fn new_krate_duplicate_version() {
381
381
382
382
let crate_to_publish = PublishBuilder :: new ( "foo_dupe" ) . version ( "1.0.0" ) ;
383
383
let response = token. enqueue_publish ( crate_to_publish) ;
384
- response. assert_status ( StatusCode :: OK ) ;
384
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
385
385
assert_eq ! (
386
386
response. json( ) ,
387
387
json!( { "errors" : [ { "detail" : "crate version `1.0.0` is already uploaded" } ] } )
@@ -400,7 +400,7 @@ fn new_crate_similar_name() {
400
400
401
401
let crate_to_publish = PublishBuilder :: new ( "foo_similar" ) . version ( "1.1.0" ) ;
402
402
let response = token. enqueue_publish ( crate_to_publish) ;
403
- response. assert_status ( StatusCode :: OK ) ;
403
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
404
404
assert_eq ! (
405
405
response. json( ) ,
406
406
json!( { "errors" : [ { "detail" : "crate was previously named `Foo_similar`" } ] } )
@@ -419,7 +419,7 @@ fn new_crate_similar_name_hyphen() {
419
419
420
420
let crate_to_publish = PublishBuilder :: new ( "foo-bar-hyphen" ) . version ( "1.1.0" ) ;
421
421
let response = token. enqueue_publish ( crate_to_publish) ;
422
- response. assert_status ( StatusCode :: OK ) ;
422
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
423
423
assert_eq ! (
424
424
response. json( ) ,
425
425
json!( { "errors" : [ { "detail" : "crate was previously named `foo_bar_hyphen`" } ] } )
@@ -438,7 +438,7 @@ fn new_crate_similar_name_underscore() {
438
438
439
439
let crate_to_publish = PublishBuilder :: new ( "foo_bar_underscore" ) . version ( "1.1.0" ) ;
440
440
let response = token. enqueue_publish ( crate_to_publish) ;
441
- response. assert_status ( StatusCode :: OK ) ;
441
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
442
442
assert_eq ! (
443
443
response. json( ) ,
444
444
json!( { "errors" : [ { "detail" : "crate was previously named `foo-bar-underscore`" } ] } )
@@ -511,7 +511,7 @@ fn new_krate_dependency_missing() {
511
511
let crate_to_publish = PublishBuilder :: new ( "foo_missing" ) . dependency ( dependency) ;
512
512
513
513
let response = token. enqueue_publish ( crate_to_publish) ;
514
- response. assert_status ( StatusCode :: OK ) ;
514
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
515
515
assert_eq ! (
516
516
response. json( ) ,
517
517
json!( { "errors" : [ { "detail" : "no known crate named `bar_missing`" } ] } )
@@ -540,7 +540,7 @@ fn new_krate_without_any_email_fails() {
540
540
let crate_to_publish = PublishBuilder :: new ( "foo_no_email" ) ;
541
541
542
542
let response = token. enqueue_publish ( crate_to_publish) ;
543
- response. assert_status ( StatusCode :: OK ) ;
543
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
544
544
assert_eq ! (
545
545
response. json( ) ,
546
546
json!( { "errors" : [ { "detail" : "A verified email address is required to publish crates to crates.io. Visit https://crates.io/me to set and verify your email address." } ] } )
@@ -561,7 +561,7 @@ fn new_krate_with_unverified_email_fails() {
561
561
let crate_to_publish = PublishBuilder :: new ( "foo_unverified_email" ) ;
562
562
563
563
let response = token. enqueue_publish ( crate_to_publish) ;
564
- response. assert_status ( StatusCode :: OK ) ;
564
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
565
565
assert_eq ! (
566
566
response. json( ) ,
567
567
json!( { "errors" : [ { "detail" : "A verified email address is required to publish crates to crates.io. Visit https://crates.io/me to set and verify your email address." } ] } )
@@ -770,7 +770,7 @@ fn author_license_and_description_required() {
770
770
. unset_authors ( ) ;
771
771
772
772
let response = token. enqueue_publish ( crate_to_publish) ;
773
- response. assert_status ( StatusCode :: OK ) ;
773
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
774
774
assert_eq ! (
775
775
response. json( ) ,
776
776
json!( { "errors" : [ { "detail" : missing_metadata_error_message( & [ "description" , "license" , "authors" ] ) } ] } )
@@ -783,7 +783,7 @@ fn author_license_and_description_required() {
783
783
. author ( "" ) ;
784
784
785
785
let response = token. enqueue_publish ( crate_to_publish) ;
786
- response. assert_status ( StatusCode :: OK ) ;
786
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
787
787
assert_eq ! (
788
788
response. json( ) ,
789
789
json!( { "errors" : [ { "detail" : missing_metadata_error_message( & [ "description" , "authors" ] ) } ] } )
@@ -796,7 +796,7 @@ fn author_license_and_description_required() {
796
796
. unset_description ( ) ;
797
797
798
798
let response = token. enqueue_publish ( crate_to_publish) ;
799
- response. assert_status ( StatusCode :: OK ) ;
799
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
800
800
assert_eq ! (
801
801
response. json( ) ,
802
802
json!( { "errors" : [ { "detail" : missing_metadata_error_message( & [ "description" ] ) } ] } )
@@ -823,7 +823,7 @@ fn new_krate_tarball_with_hard_links() {
823
823
let crate_to_publish = PublishBuilder :: new ( "foo" ) . version ( "1.1.0" ) . tarball ( tarball) ;
824
824
825
825
let response = token. enqueue_publish ( crate_to_publish) ;
826
- response. assert_status ( StatusCode :: OK ) ;
826
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
827
827
assert_eq ! (
828
828
response. json( ) ,
829
829
json!( { "errors" : [ { "detail" : "uploaded tarball is malformed or too large when decompressed" } ] } )
@@ -842,13 +842,12 @@ fn publish_new_crate_rate_limited() {
842
842
843
843
// Uploading a second crate is limited
844
844
let crate_to_publish = PublishBuilder :: new ( "rate_limited2" ) ;
845
- token
846
- . enqueue_publish ( crate_to_publish)
847
- . assert_status ( StatusCode :: TOO_MANY_REQUESTS ) ;
845
+ let response = token. enqueue_publish ( crate_to_publish) ;
846
+ assert_eq ! ( response. status( ) , StatusCode :: TOO_MANY_REQUESTS ) ;
848
847
app. run_pending_background_jobs ( ) ;
849
848
850
- anon. get :: < ( ) > ( "/api/v1/crates/rate_limited2" )
851
- . assert_status ( StatusCode :: NOT_FOUND ) ;
849
+ let response = anon. get :: < ( ) > ( "/api/v1/crates/rate_limited2" ) ;
850
+ assert_eq ! ( response . status ( ) , StatusCode :: NOT_FOUND ) ;
852
851
853
852
// Wait for the limit to be up
854
853
thread:: sleep ( Duration :: from_millis ( 500 ) ) ;
0 commit comments