Skip to content

Commit

Permalink
test: new test for registered users to update torrents someone elses …
Browse files Browse the repository at this point in the history
…torrents
  • Loading branch information
mario-nt committed Oct 9, 2024
1 parent e1f87e2 commit a09cadb
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 @@ -1197,6 +1197,39 @@ mod for_authenticated_users {

assert_eq!(response.status, 403);
}
#[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;
}

// Given a users uploads a torrent
let uploader = new_logged_in_user(&env).await;
let (test_torrent, _uploaded_torrent) = upload_random_torrent_to_index(&uploader, &env).await;

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

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);
}
}
}
}
Expand Down

0 comments on commit a09cadb

Please sign in to comment.