Skip to content

Commit b8aace5

Browse files
committed
Fix tests
1 parent cc44c06 commit b8aace5

File tree

12 files changed

+64
-54
lines changed

12 files changed

+64
-54
lines changed

src/bin/monitor.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ fn check_stalled_update_downloads(conn: &PgConnection) -> Result<()> {
110110
fn check_spam_attack(conn: &PgConnection) -> Result<()> {
111111
use cargo_registry::models::krate::canon_crate_name;
112112
use diesel::dsl::*;
113-
use diesel::sql_types::Bool;
114113

115114
const EVENT_KEY: &str = "spam_attack";
116115

src/controllers/krate/publish.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ pub fn publish(req: &mut dyn RequestExt) -> EndpointResult {
160160
file_length as i32,
161161
user.id,
162162
)?
163-
.save(&conn, &new_crate.authors, &verified_email_address)?;
163+
.save(&conn, &verified_email_address)?;
164164

165165
insert_version_owner_action(
166166
&conn,

src/downloads_counter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ mod tests {
452452
self.user.id,
453453
)
454454
.expect("failed to create version")
455-
.save(conn, &[], "[email protected]")
455+
.save(conn, "[email protected]")
456456
.expect("failed to save version");
457457

458458
self.next_version += 1;

src/models/version.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,7 @@ impl NewVersion {
136136
Ok(new_version)
137137
}
138138

139-
pub fn save(
140-
&self,
141-
conn: &PgConnection,
142-
authors: &[String],
143-
published_by_email: &str,
144-
) -> AppResult<Version> {
139+
pub fn save(&self, conn: &PgConnection, published_by_email: &str) -> AppResult<Version> {
145140
use crate::schema::versions::dsl::*;
146141
use diesel::dsl::exists;
147142
use diesel::{insert_into, select};

src/schema.patch

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
diff --git a/src/schema.rs b/src/schema.rs
2+
index 1570becc..b1d09d0d 100644
3+
--- a/src/schema.rs
4+
+++ b/src/schema.rs
5+
@@ -814,35 +814,6 @@ table! {
6+
}
7+
}
8+
9+
-table! {
10+
- use diesel::sql_types::*;
11+
- use diesel_full_text_search::{TsVector as Tsvector};
12+
-
13+
- /// Representation of the `version_authors` table.
14+
- ///
15+
- /// (Automatically generated by Diesel.)
16+
- version_authors (id) {
17+
- /// The `id` column of the `version_authors` table.
18+
- ///
19+
- /// Its SQL type is `Int4`.
20+
- ///
21+
- /// (Automatically generated by Diesel.)
22+
- id -> Int4,
23+
- /// The `version_id` column of the `version_authors` table.
24+
- ///
25+
- /// Its SQL type is `Int4`.
26+
- ///
27+
- /// (Automatically generated by Diesel.)
28+
- version_id -> Int4,
29+
- /// The `name` column of the `version_authors` table.
30+
- ///
31+
- /// Its SQL type is `Varchar`.
32+
- ///
33+
- /// (Automatically generated by Diesel.)
34+
- name -> Varchar,
35+
- }
36+
-}
37+
-
38+
table! {
39+
use diesel::sql_types::*;
40+
use diesel_full_text_search::{TsVector as Tsvector};
41+
@@ -1050,7 +1021,6 @@ joinable!(publish_limit_buckets -> users (user_id));
42+
joinable!(publish_rate_overrides -> users (user_id));
43+
joinable!(readme_renderings -> versions (version_id));
44+
joinable!(recent_crate_downloads -> crates (crate_id));
45+
-joinable!(version_authors -> versions (version_id));
46+
joinable!(version_downloads -> versions (version_id));
47+
joinable!(version_owner_actions -> api_tokens (api_token_id));
48+
joinable!(version_owner_actions -> users (user_id));
49+
@@ -1081,7 +1051,6 @@ allow_tables_to_appear_in_same_query!(
50+
reserved_crate_names,
51+
teams,
52+
users,
53+
- version_authors,
54+
version_downloads,
55+
version_owner_actions,
56+
versions,

src/schema.rs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -814,35 +814,6 @@ table! {
814814
}
815815
}
816816

817-
table! {
818-
use diesel::sql_types::*;
819-
use diesel_full_text_search::{TsVector as Tsvector};
820-
821-
/// Representation of the `version_authors` table.
822-
///
823-
/// (Automatically generated by Diesel.)
824-
version_authors (id) {
825-
/// The `id` column of the `version_authors` table.
826-
///
827-
/// Its SQL type is `Int4`.
828-
///
829-
/// (Automatically generated by Diesel.)
830-
id -> Int4,
831-
/// The `version_id` column of the `version_authors` table.
832-
///
833-
/// Its SQL type is `Int4`.
834-
///
835-
/// (Automatically generated by Diesel.)
836-
version_id -> Int4,
837-
/// The `name` column of the `version_authors` table.
838-
///
839-
/// Its SQL type is `Varchar`.
840-
///
841-
/// (Automatically generated by Diesel.)
842-
name -> Varchar,
843-
}
844-
}
845-
846817
table! {
847818
use diesel::sql_types::*;
848819
use diesel_full_text_search::{TsVector as Tsvector};
@@ -1050,7 +1021,6 @@ joinable!(publish_limit_buckets -> users (user_id));
10501021
joinable!(publish_rate_overrides -> users (user_id));
10511022
joinable!(readme_renderings -> versions (version_id));
10521023
joinable!(recent_crate_downloads -> crates (crate_id));
1053-
joinable!(version_authors -> versions (version_id));
10541024
joinable!(version_downloads -> versions (version_id));
10551025
joinable!(version_owner_actions -> api_tokens (api_token_id));
10561026
joinable!(version_owner_actions -> users (user_id));
@@ -1081,7 +1051,6 @@ allow_tables_to_appear_in_same_query!(
10811051
reserved_crate_names,
10821052
teams,
10831053
users,
1084-
version_authors,
10851054
version_downloads,
10861055
version_owner_actions,
10871056
versions,

src/tasks/dump_db/dump-db.toml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,6 @@ account_lock_until = "private"
179179
[users.column_defaults]
180180
gh_access_token = "''"
181181

182-
[version_authors]
183-
dependencies = ["versions"]
184-
[version_authors.columns]
185-
id = "public"
186-
version_id = "public"
187-
name = "public"
188-
189182
[version_downloads]
190183
dependencies = ["versions"]
191184
[version_downloads.columns]

src/tasks/update_downloads.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ mod test {
110110
user_id,
111111
)
112112
.unwrap();
113-
let version = version.save(conn, &[], "[email protected]").unwrap();
113+
let version = version.save(conn, "[email protected]").unwrap();
114114
(krate, version)
115115
}
116116

src/tests/builders/publish.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ impl PublishBuilder {
186186
vers: u::EncodableCrateVersion(self.version),
187187
features: HashMap::new(),
188188
deps: self.deps,
189-
authors: self.authors,
190189
description: self.desc,
191190
homepage: None,
192191
documentation: self.doc_url,

src/tests/builders/version.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl<'a> VersionBuilder<'a> {
9292
self.size,
9393
published_by,
9494
)?
95-
.save(connection, &[], "[email protected]")?;
95+
.save(connection, "[email protected]")?;
9696

9797
if self.yanked {
9898
vers = update(&vers)

src/tests/krate/publish.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -703,23 +703,23 @@ fn bad_keywords() {
703703
assert_eq!(response.status(), StatusCode::OK);
704704
assert_eq!(
705705
response.json(),
706-
json!({ "errors": [{ "detail": "invalid upload request: invalid length 29, expected a keyword with less than 20 characters at line 1 column 221" }] })
706+
json!({ "errors": [{ "detail": "invalid upload request: invalid length 29, expected a keyword with less than 20 characters at line 1 column 203" }] })
707707
);
708708

709709
let crate_to_publish = PublishBuilder::new("foo_bad_key").keyword("?@?%");
710710
let response = token.enqueue_publish(crate_to_publish);
711711
assert_eq!(response.status(), StatusCode::OK);
712712
assert_eq!(
713713
response.json(),
714-
json!({ "errors": [{ "detail": "invalid upload request: invalid value: string \"?@?%\", expected a valid keyword specifier at line 1 column 196" }] })
714+
json!({ "errors": [{ "detail": "invalid upload request: invalid value: string \"?@?%\", expected a valid keyword specifier at line 1 column 178" }] })
715715
);
716716

717717
let crate_to_publish = PublishBuilder::new("foo_bad_key").keyword("áccênts");
718718
let response = token.enqueue_publish(crate_to_publish);
719719
assert_eq!(response.status(), StatusCode::OK);
720720
assert_eq!(
721721
response.json(),
722-
json!({ "errors": [{ "detail": "invalid upload request: invalid value: string \"áccênts\", expected a valid keyword specifier at line 1 column 201" }] })
722+
json!({ "errors": [{ "detail": "invalid upload request: invalid value: string \"áccênts\", expected a valid keyword specifier at line 1 column 183" }] })
723723
);
724724
}
725725

src/views/krate_publish.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ pub struct EncodableCrateUpload {
1818
pub vers: EncodableCrateVersion,
1919
pub deps: Vec<EncodableCrateDependency>,
2020
pub features: HashMap<EncodableFeatureName, Vec<EncodableFeature>>,
21-
pub authors: Vec<String>,
2221
pub description: Option<String>,
2322
pub homepage: Option<String>,
2423
pub documentation: Option<String>,

0 commit comments

Comments
 (0)