@@ -1079,6 +1079,10 @@ fn new_krate_with_readme() {
1079
1079
fn new_krate_without_any_email_warns ( ) {
1080
1080
let ( app, _, _, token) = TestApp :: with_proxy ( ) . with_token ( ) ;
1081
1081
1082
+ app. db ( |conn| {
1083
+ delete ( emails:: table) . execute ( conn) . unwrap ( ) ;
1084
+ } ) ;
1085
+
1082
1086
let crate_to_publish = PublishBuilder :: new ( "foo_no_email" ) ;
1083
1087
1084
1088
let json = token. publish ( crate_to_publish) . good ( ) ;
@@ -1100,15 +1104,11 @@ fn new_krate_without_any_email_warns() {
1100
1104
// See https://github.com/rust-lang/crates-io-cargo-teams/issues/8
1101
1105
#[ test]
1102
1106
fn new_krate_with_unverified_email_warns ( ) {
1103
- let ( app, _, user, token) = TestApp :: with_proxy ( ) . with_token ( ) ;
1104
- let user = user. as_model ( ) ;
1107
+ let ( app, _, _, token) = TestApp :: with_proxy ( ) . with_token ( ) ;
1105
1108
1106
1109
app. db ( |conn| {
1107
- insert_into ( emails:: table)
1108
- . values ( (
1109
- emails:: user_id. eq ( user. id ) ,
1110
- emails
:: email
. eq ( "[email protected] " ) ,
1111
- ) )
1110
+ update ( emails:: table)
1111
+ . set ( ( emails:: verified. eq ( false ) , ) )
1112
1112
. execute ( conn)
1113
1113
. unwrap ( ) ;
1114
1114
} ) ;
@@ -1132,22 +1132,7 @@ fn new_krate_with_unverified_email_warns() {
1132
1132
1133
1133
#[ test]
1134
1134
fn new_krate_with_verified_email_doesnt_warn ( ) {
1135
- let ( app, _, user, token) = TestApp :: with_proxy ( ) . with_token ( ) ;
1136
- let user = user. as_model ( ) ;
1137
-
1138
- // TODO: Move this to TestApp setup for user so we don't have to do this for every test
1139
- // that publishes a crate; then edit the test for the user without a verified email to
1140
- // remove the verified email
1141
- app. db ( |conn| {
1142
- insert_into ( emails:: table)
1143
- . values ( (
1144
- emails:: user_id. eq ( user. id ) ,
1145
- emails
:: email
. eq ( "[email protected] " ) ,
1146
- emails:: verified. eq ( true ) ,
1147
- ) )
1148
- . execute ( conn)
1149
- . unwrap ( ) ;
1150
- } ) ;
1135
+ let ( app, _, _, token) = TestApp :: with_proxy ( ) . with_token ( ) ;
1151
1136
1152
1137
let crate_to_publish = PublishBuilder :: new ( "foo_verified_email" ) ;
1153
1138
0 commit comments