Skip to content

Commit

Permalink
test: new test for admin users to update their own torrents
Browse files Browse the repository at this point in the history
  • Loading branch information
mario-nt committed Oct 12, 2024
1 parent 06913ea commit d41361b
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/e2e/web/api/v1/contexts/torrent/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1577,6 +1577,39 @@ mod and_admins {
let new_title = format!("{}-new-title", test_torrent.index_info.title);
let new_description = format!("{}-new-description", test_torrent.index_info.description);

let response = client
.update_torrent(
&test_torrent.file_info_hash(),
UpdateTorrentFrom {
title: Some(new_title.clone()),
description: Some(new_description.clone()),
category: None,
tags: None,
},
)
.await;

assert_eq!(response.status, 200);
}
#[tokio::test]
async fn it_should_allow_registered_users_to_update_their_own_torrents() {
let mut env = TestEnv::new();
env.start(api::Version::V1).await;

if !env.provides_a_tracker() {
println!("test skipped. It requires a tracker to be running.");
return;
}

let admin = new_logged_in_admin(&env).await;

let client = Client::authenticated(&env.server_socket_addr().unwrap(), &admin.token);

let (test_torrent, _uploaded_torrent) = upload_random_torrent_to_index(&admin, &env).await;

let new_title = format!("{}-new-title", test_torrent.index_info.title);
let new_description = format!("{}-new-description", test_torrent.index_info.description);

let response = client
.update_torrent(
&test_torrent.file_info_hash(),
Expand Down

0 comments on commit d41361b

Please sign in to comment.