@@ -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" } ] } )
@@ -278,7 +278,7 @@ fn reject_new_crate_with_alternative_registry_dependency() {
278
278
279
279
let crate_to_publish = PublishBuilder :: new ( "depends-on-alt-registry" ) . dependency ( dependency) ;
280
280
let response = token. enqueue_publish ( crate_to_publish) ;
281
- response. assert_status ( StatusCode :: OK ) ;
281
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
282
282
assert_eq ! (
283
283
response. json( ) ,
284
284
json!( { "errors" : [ { "detail" : "Dependency `dep` is hosted on another registry. Cross-registry dependencies are not permitted on crates.io." } ] } )
@@ -301,7 +301,7 @@ fn new_krate_with_wildcard_dependency() {
301
301
. dependency ( dependency) ;
302
302
303
303
let response = token. enqueue_publish ( crate_to_publish) ;
304
- response. assert_status ( StatusCode :: OK ) ;
304
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
305
305
assert_eq ! (
306
306
response. json( ) ,
307
307
json!( { "errors" : [ { "detail" : WILDCARD_ERROR_MESSAGE } ] } )
@@ -340,7 +340,7 @@ fn new_krate_wrong_user() {
340
340
let crate_to_publish = PublishBuilder :: new ( "foo_wrong" ) . version ( "2.0.0" ) ;
341
341
342
342
let response = another_user. enqueue_publish ( crate_to_publish) ;
343
- response. assert_status ( StatusCode :: OK ) ;
343
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
344
344
assert_eq ! (
345
345
response. json( ) ,
346
346
json!( { "errors" : [ { "detail" : MISSING_RIGHTS_ERROR_MESSAGE } ] } )
@@ -355,7 +355,7 @@ fn new_krate_too_big() {
355
355
let builder = PublishBuilder :: new ( "foo_big" ) . files ( & files) ;
356
356
357
357
let response = user. enqueue_publish ( builder) ;
358
- response. assert_status ( StatusCode :: OK ) ;
358
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
359
359
assert_eq ! (
360
360
response. json( ) ,
361
361
json!( { "errors" : [ { "detail" : "uploaded tarball is malformed or too large when decompressed" } ] } )
@@ -388,7 +388,7 @@ fn new_krate_wrong_files() {
388
388
let builder = PublishBuilder :: new ( "foo" ) . files ( & files) ;
389
389
390
390
let response = user. enqueue_publish ( builder) ;
391
- response. assert_status ( StatusCode :: OK ) ;
391
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
392
392
assert_eq ! (
393
393
response. json( ) ,
394
394
json!( { "errors" : [ { "detail" : "invalid tarball uploaded" } ] } )
@@ -407,7 +407,7 @@ fn new_krate_gzip_bomb() {
407
407
. files_with_io ( & mut [ ( "foo-1.1.0/a" , & mut body, len) ] ) ;
408
408
409
409
let response = token. enqueue_publish ( crate_to_publish) ;
410
- response. assert_status ( StatusCode :: OK ) ;
410
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
411
411
assert_eq ! (
412
412
response. json( ) ,
413
413
json!( { "errors" : [ { "detail" : "uploaded tarball is malformed or too large when decompressed" } ] } )
@@ -427,7 +427,7 @@ fn new_krate_duplicate_version() {
427
427
428
428
let crate_to_publish = PublishBuilder :: new ( "foo_dupe" ) . version ( "1.0.0" ) ;
429
429
let response = token. enqueue_publish ( crate_to_publish) ;
430
- response. assert_status ( StatusCode :: OK ) ;
430
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
431
431
assert_eq ! (
432
432
response. json( ) ,
433
433
json!( { "errors" : [ { "detail" : "crate version `1.0.0` is already uploaded" } ] } )
@@ -446,7 +446,7 @@ fn new_crate_similar_name() {
446
446
447
447
let crate_to_publish = PublishBuilder :: new ( "foo_similar" ) . version ( "1.1.0" ) ;
448
448
let response = token. enqueue_publish ( crate_to_publish) ;
449
- response. assert_status ( StatusCode :: OK ) ;
449
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
450
450
assert_eq ! (
451
451
response. json( ) ,
452
452
json!( { "errors" : [ { "detail" : "crate was previously named `Foo_similar`" } ] } )
@@ -465,7 +465,7 @@ fn new_crate_similar_name_hyphen() {
465
465
466
466
let crate_to_publish = PublishBuilder :: new ( "foo-bar-hyphen" ) . version ( "1.1.0" ) ;
467
467
let response = token. enqueue_publish ( crate_to_publish) ;
468
- response. assert_status ( StatusCode :: OK ) ;
468
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
469
469
assert_eq ! (
470
470
response. json( ) ,
471
471
json!( { "errors" : [ { "detail" : "crate was previously named `foo_bar_hyphen`" } ] } )
@@ -484,7 +484,7 @@ fn new_crate_similar_name_underscore() {
484
484
485
485
let crate_to_publish = PublishBuilder :: new ( "foo_bar_underscore" ) . version ( "1.1.0" ) ;
486
486
let response = token. enqueue_publish ( crate_to_publish) ;
487
- response. assert_status ( StatusCode :: OK ) ;
487
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
488
488
assert_eq ! (
489
489
response. json( ) ,
490
490
json!( { "errors" : [ { "detail" : "crate was previously named `foo-bar-underscore`" } ] } )
@@ -557,7 +557,7 @@ fn new_krate_dependency_missing() {
557
557
let crate_to_publish = PublishBuilder :: new ( "foo_missing" ) . dependency ( dependency) ;
558
558
559
559
let response = token. enqueue_publish ( crate_to_publish) ;
560
- response. assert_status ( StatusCode :: OK ) ;
560
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
561
561
assert_eq ! (
562
562
response. json( ) ,
563
563
json!( { "errors" : [ { "detail" : "no known crate named `bar_missing`" } ] } )
@@ -586,7 +586,7 @@ fn new_krate_without_any_email_fails() {
586
586
let crate_to_publish = PublishBuilder :: new ( "foo_no_email" ) ;
587
587
588
588
let response = token. enqueue_publish ( crate_to_publish) ;
589
- response. assert_status ( StatusCode :: OK ) ;
589
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
590
590
assert_eq ! (
591
591
response. json( ) ,
592
592
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." } ] } )
@@ -607,7 +607,7 @@ fn new_krate_with_unverified_email_fails() {
607
607
let crate_to_publish = PublishBuilder :: new ( "foo_unverified_email" ) ;
608
608
609
609
let response = token. enqueue_publish ( crate_to_publish) ;
610
- response. assert_status ( StatusCode :: OK ) ;
610
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
611
611
assert_eq ! (
612
612
response. json( ) ,
613
613
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." } ] } )
@@ -816,7 +816,7 @@ fn author_license_and_description_required() {
816
816
. unset_authors ( ) ;
817
817
818
818
let response = token. enqueue_publish ( crate_to_publish) ;
819
- response. assert_status ( StatusCode :: OK ) ;
819
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
820
820
assert_eq ! (
821
821
response. json( ) ,
822
822
json!( { "errors" : [ { "detail" : missing_metadata_error_message( & [ "description" , "license" , "authors" ] ) } ] } )
@@ -829,7 +829,7 @@ fn author_license_and_description_required() {
829
829
. author ( "" ) ;
830
830
831
831
let response = token. enqueue_publish ( crate_to_publish) ;
832
- response. assert_status ( StatusCode :: OK ) ;
832
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
833
833
assert_eq ! (
834
834
response. json( ) ,
835
835
json!( { "errors" : [ { "detail" : missing_metadata_error_message( & [ "description" , "authors" ] ) } ] } )
@@ -842,7 +842,7 @@ fn author_license_and_description_required() {
842
842
. unset_description ( ) ;
843
843
844
844
let response = token. enqueue_publish ( crate_to_publish) ;
845
- response. assert_status ( StatusCode :: OK ) ;
845
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
846
846
assert_eq ! (
847
847
response. json( ) ,
848
848
json!( { "errors" : [ { "detail" : missing_metadata_error_message( & [ "description" ] ) } ] } )
@@ -869,7 +869,7 @@ fn new_krate_tarball_with_hard_links() {
869
869
let crate_to_publish = PublishBuilder :: new ( "foo" ) . version ( "1.1.0" ) . tarball ( tarball) ;
870
870
871
871
let response = token. enqueue_publish ( crate_to_publish) ;
872
- response. assert_status ( StatusCode :: OK ) ;
872
+ assert_eq ! ( response. status ( ) , StatusCode :: OK ) ;
873
873
assert_eq ! (
874
874
response. json( ) ,
875
875
json!( { "errors" : [ { "detail" : "uploaded tarball is malformed or too large when decompressed" } ] } )
@@ -888,13 +888,12 @@ fn publish_new_crate_rate_limited() {
888
888
889
889
// Uploading a second crate is limited
890
890
let crate_to_publish = PublishBuilder :: new ( "rate_limited2" ) ;
891
- token
892
- . enqueue_publish ( crate_to_publish)
893
- . assert_status ( StatusCode :: TOO_MANY_REQUESTS ) ;
891
+ let response = token. enqueue_publish ( crate_to_publish) ;
892
+ assert_eq ! ( response. status( ) , StatusCode :: TOO_MANY_REQUESTS ) ;
894
893
app. run_pending_background_jobs ( ) ;
895
894
896
- anon. get :: < ( ) > ( "/api/v1/crates/rate_limited2" )
897
- . assert_status ( StatusCode :: NOT_FOUND ) ;
895
+ let response = anon. get :: < ( ) > ( "/api/v1/crates/rate_limited2" ) ;
896
+ assert_eq ! ( response . status ( ) , StatusCode :: NOT_FOUND ) ;
898
897
899
898
// Wait for the limit to be up
900
899
thread:: sleep ( Duration :: from_millis ( 500 ) ) ;
0 commit comments