Skip to content

Commit

Permalink
CI test
Browse files Browse the repository at this point in the history
  • Loading branch information
MMelchor committed Oct 2, 2023
1 parent f5a704c commit bdc9932
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ALTER TABLE torrust_torrents ADD COLUMN "encoding" TEXT NULL;
ALTER TABLE torrust_torrents ADD COLUMN ncoding TEXT NULL;
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ALTER TABLE "torrust_torrents" ADD COLUMN "encoding" TEXT NULL;
ALTER TABLE "torrust_torrents" ADD COLUMN ncoding TEXT NULL;
10 changes: 5 additions & 5 deletions src/databases/mysql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ impl Database for Mysql {
tt.comment,
tt.creation_date,
tt.created_by,
tt.encoding,
tt.ncoding,
CAST(COALESCE(sum(ts.seeders),0) as signed) as seeders,
CAST(COALESCE(sum(ts.leechers),0) as signed) as leechers
FROM torrust_torrents tt
Expand Down Expand Up @@ -471,7 +471,7 @@ impl Database for Mysql {
date_uploaded,
creation_date,
created_by,
encoding
ncoding
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, UTC_TIMESTAMP(), ?, ?, ?)",
)
.bind(uploader_id)
Expand All @@ -487,7 +487,7 @@ impl Database for Mysql {
.bind(torrent.comment.clone())
.bind(torrent.creation_date)
.bind(torrent.created_by.clone())
.bind(torrent.encoding.clone())
.bind(torrent.ncoding.clone())
.execute(&mut tx)
.await
.map(|v| i64::try_from(v.last_insert_id()).expect("last ID is larger than i64"))
Expand Down Expand Up @@ -765,7 +765,7 @@ impl Database for Mysql {
tt.comment,
tt.creation_date,
tt.created_by,
tt.encoding,
tt.ncoding,
CAST(COALESCE(sum(ts.seeders),0) as signed) as seeders,
CAST(COALESCE(sum(ts.leechers),0) as signed) as leechers
FROM torrust_torrents tt
Expand Down Expand Up @@ -796,7 +796,7 @@ impl Database for Mysql {
tt.comment,
tt.creation_date,
tt.created_by,
tt.encoding,
tt.ncoding,
CAST(COALESCE(sum(ts.seeders),0) as signed) as seeders,
CAST(COALESCE(sum(ts.leechers),0) as signed) as leechers
FROM torrust_torrents tt
Expand Down
10 changes: 5 additions & 5 deletions src/databases/sqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ impl Database for Sqlite {
tt.comment,
tt.creation_date,
tt.created_by,
tt.encoding,
tt.ncoding,
CAST(COALESCE(sum(ts.seeders),0) as signed) as seeders,
CAST(COALESCE(sum(ts.leechers),0) as signed) as leechers
FROM torrust_torrents tt
Expand Down Expand Up @@ -461,7 +461,7 @@ impl Database for Sqlite {
date_uploaded,
creation_date,
created_by,
encoding
ncoding
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, strftime('%Y-%m-%d %H:%M:%S',DATETIME('now', 'utc')), ?, ?, ?)",
)
.bind(uploader_id)
Expand All @@ -477,7 +477,7 @@ impl Database for Sqlite {
.bind(torrent.comment.clone())
.bind(torrent.creation_date)
.bind(torrent.created_by.clone())
.bind(torrent.encoding.clone())
.bind(torrent.ncoding.clone())
.execute(&mut tx)
.await
.map(|v| v.last_insert_rowid())
Expand Down Expand Up @@ -754,7 +754,7 @@ impl Database for Sqlite {
tt.comment,
tt.creation_date,
tt.created_by,
tt.encoding,
tt.ncoding,
CAST(COALESCE(sum(ts.seeders),0) as signed) as seeders,
CAST(COALESCE(sum(ts.leechers),0) as signed) as leechers
FROM torrust_torrents tt
Expand Down Expand Up @@ -784,7 +784,7 @@ impl Database for Sqlite {
tt.comment,
tt.creation_date,
tt.created_by,
tt.encoding,
tt.ncoding,
CAST(COALESCE(sum(ts.seeders),0) as signed) as seeders,
CAST(COALESCE(sum(ts.leechers),0) as signed) as leechers
FROM torrust_torrents tt
Expand Down
4 changes: 2 additions & 2 deletions src/models/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub struct TorrentResponse {
pub comment: Option<String>,
pub creation_date: Option<i64>,
pub created_by: Option<String>,
pub encoding: Option<String>,
pub ncoding: Option<String>,
}

impl TorrentResponse {
Expand All @@ -90,7 +90,7 @@ impl TorrentResponse {
comment: torrent_listing.comment,
creation_date: torrent_listing.creation_date,
created_by: torrent_listing.created_by,
encoding: torrent_listing.encoding,
ncoding: torrent_listing.ncoding,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/models/torrent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub struct TorrentListing {
pub comment: Option<String>,
pub creation_date: Option<i64>,
pub created_by: Option<String>,
pub encoding: Option<String>,
pub ncoding: Option<String>,
}

#[derive(Debug, Display, PartialEq, Eq, Error)]
Expand Down
16 changes: 8 additions & 8 deletions src/models/torrent_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub struct Torrent {
#[serde(default)]
pub nodes: Option<Vec<TorrentNode>>,
#[serde(default)]
pub encoding: Option<String>,
pub ncoding: Option<String>,
#[serde(default)]
pub httpseeds: Option<Vec<String>>,
#[serde(default)]
Expand Down Expand Up @@ -91,7 +91,7 @@ impl Torrent {
info: info_dict,
announce: None,
nodes: None,
encoding: db_torrent.encoding.clone(),
ncoding: db_torrent.ncoding.clone(),
httpseeds: None,
announce_list: Some(torrent_announce_urls),
creation_date: db_torrent.creation_date,
Expand Down Expand Up @@ -308,7 +308,7 @@ pub struct DbTorrent {
pub comment: Option<String>,
pub creation_date: Option<i64>,
pub created_by: Option<String>,
pub encoding: Option<String>,
pub ncoding: Option<String>,
}

#[allow(clippy::module_name_repetitions)]
Expand Down Expand Up @@ -393,7 +393,7 @@ mod tests {
comment: None,
created_by: None,
nodes: None,
encoding: None,
ncoding: None,
httpseeds: None,
};

Expand Down Expand Up @@ -434,7 +434,7 @@ mod tests {
comment: None,
created_by: None,
nodes: None,
encoding: None,
ncoding: None,
httpseeds: None,
};

Expand Down Expand Up @@ -473,7 +473,7 @@ mod tests {
comment: None,
created_by: None,
nodes: None,
encoding: None,
ncoding: None,
httpseeds: None,
};

Expand Down Expand Up @@ -508,7 +508,7 @@ mod tests {
comment: None,
created_by: None,
nodes: None,
encoding: None,
ncoding: None,
httpseeds: None,
};

Expand Down Expand Up @@ -543,7 +543,7 @@ mod tests {
comment: None,
created_by: None,
nodes: None,
encoding: None,
ncoding: None,
httpseeds: None,
};

Expand Down
8 changes: 4 additions & 4 deletions src/services/torrent_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub struct CreateTorrentRequest {
pub comment: Option<String>,
pub creation_date: Option<i64>,
pub created_by: Option<String>,
pub encoding: Option<String>,
pub ncoding: Option<String>,
}

impl CreateTorrentRequest {
Expand All @@ -38,7 +38,7 @@ impl CreateTorrentRequest {
info: info_dict,
announce: None,
nodes: None,
encoding: self.encoding.clone(),
ncoding: self.ncoding.clone(),
httpseeds: None,
announce_list: Some(self.announce_urls.clone()),
creation_date: self.creation_date,
Expand Down Expand Up @@ -98,7 +98,7 @@ pub fn generate_random_torrent(id: Uuid) -> Torrent {
comment: None,
creation_date: None,
created_by: None,
encoding: None,
ncoding: None,
};

create_torrent_req.build_torrent()
Expand Down Expand Up @@ -139,7 +139,7 @@ mod tests {
comment: None,
created_by: None,
nodes: None,
encoding: None,
ncoding: None,
httpseeds: None,
};

Expand Down
2 changes: 1 addition & 1 deletion tests/common/contexts/torrent/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub struct TorrentFileInfo {
pub comment: Option<String>,
pub creation_date: Option<i64>,
pub created_by: Option<String>,
pub encoding: Option<String>,
pub ncoding: Option<String>,
pub source: Option<String>,
pub info_hash: String,
pub torrent_size: u64,
Expand Down
4 changes: 2 additions & 2 deletions tests/common/contexts/torrent/responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub struct ListItem {
pub comment: Option<String>,
pub creation_date: Option<i64>,
pub created_by: Option<String>,
pub encoding: Option<String>,
pub ncoding: Option<String>,
}

#[derive(Deserialize, PartialEq, Debug)]
Expand Down Expand Up @@ -71,7 +71,7 @@ pub struct TorrentDetails {
pub comment: Option<String>,
pub creation_date: Option<i64>,
pub created_by: Option<String>,
pub encoding: Option<String>,
pub ncoding: Option<String>,
}

#[derive(Deserialize, PartialEq, Debug)]
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/web/api/v1/contexts/torrent/asserts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ pub async fn canonical_torrent_for(
// See https://github.com/torrust/torrust-index-backend/issues/284
// They are ignore when the user uploads the torrent. So the stored
// canonical torrent does not contain them.
uploaded_torrent.encoding = None;
uploaded_torrent.creation_date = None;
uploaded_torrent.created_by = None;
// uploaded_torrent.encoding = None;
//uploaded_torrent.creation_date = None;
//uploaded_torrent.created_by = None;

uploaded_torrent
}
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/web/api/v1/contexts/torrent/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ mod for_guests {
comment: test_torrent.file_info.comment.clone(),
creation_date: test_torrent.file_info.creation_date,
created_by: test_torrent.file_info.created_by.clone(),
encoding: test_torrent.file_info.encoding.clone(),
ncoding: test_torrent.file_info.ncoding.clone(),
};

assert_expected_torrent_details(&torrent_details_response.data, &expected_torrent);
Expand Down

0 comments on commit bdc9932

Please sign in to comment.