@@ -6,7 +6,7 @@ use crate::{
6
6
use cargo_registry:: {
7
7
git,
8
8
models:: { krate:: MAX_NAME_LENGTH , Category , Crate } ,
9
- schema:: { api_tokens, crates, emails, metadata, versions} ,
9
+ schema:: { api_tokens, crates, emails, metadata, versions, versions_published_by } ,
10
10
views:: {
11
11
EncodableCategory , EncodableCrate , EncodableDependency , EncodableKeyword , EncodableVersion ,
12
12
EncodableVersionDownload ,
@@ -1077,7 +1077,7 @@ fn new_krate_with_readme() {
1077
1077
// See https://github.com/rust-lang/crates-io-cargo-teams/issues/8
1078
1078
#[ test]
1079
1079
fn new_krate_without_any_email_warns ( ) {
1080
- let ( _ , _, _, token) = TestApp :: with_proxy ( ) . with_token ( ) ;
1080
+ let ( app , _, _, token) = TestApp :: with_proxy ( ) . with_token ( ) ;
1081
1081
1082
1082
let crate_to_publish = PublishBuilder :: new ( "foo_no_email" ) ;
1083
1083
@@ -1086,6 +1086,14 @@ fn new_krate_without_any_email_warns() {
1086
1086
assert_eq ! ( json. warnings. other[ 0 ] , "You do not currently have a verified email address \
1087
1087
associated with your crates.io account. Starting 2019-02-28, a verified email will be required \
1088
1088
to publish crates. Visit https://crates.io/me to set and verify your email address.") ;
1089
+
1090
+ // Don't record a verified email if there isn't one
1091
+ app. db ( |conn| {
1092
+ let email = versions_published_by:: table
1093
+ . select ( versions_published_by:: email)
1094
+ . first :: < String > ( conn) ;
1095
+ assert ! ( email. is_err( ) ) ;
1096
+ } ) ;
1089
1097
}
1090
1098
1091
1099
// This warning will soon become a hard error.
@@ -1112,6 +1120,14 @@ fn new_krate_with_unverified_email_warns() {
1112
1120
assert_eq ! ( json. warnings. other[ 0 ] , "You do not currently have a verified email address \
1113
1121
associated with your crates.io account. Starting 2019-02-28, a verified email will be required \
1114
1122
to publish crates. Visit https://crates.io/me to set and verify your email address.") ;
1123
+
1124
+ // Don't record a verified email if there isn't one
1125
+ app. db ( |conn| {
1126
+ let email = versions_published_by:: table
1127
+ . select ( versions_published_by:: email)
1128
+ . first :: < String > ( conn) ;
1129
+ assert ! ( email. is_err( ) ) ;
1130
+ } ) ;
1115
1131
}
1116
1132
1117
1133
#[ test]
@@ -1137,6 +1153,15 @@ fn new_krate_with_verified_email_doesnt_warn() {
1137
1153
1138
1154
let json = token. publish ( crate_to_publish) . good ( ) ;
1139
1155
assert_eq ! ( json. warnings. other. len( ) , 0 ) ;
1156
+
1157
+ // Record a verified email because there is one
1158
+ app. db ( |conn| {
1159
+ let email = versions_published_by:: table
1160
+ . select ( versions_published_by:: email)
1161
+ . first :: < String > ( conn)
1162
+ . unwrap ( ) ;
1163
+ assert_eq ! ( email
, "[email protected] " ) ;
1164
+ } ) ;
1140
1165
}
1141
1166
1142
1167
#[ test]
0 commit comments