Skip to content

Commit 9a1b174

Browse files
committed
test: new test for admin users to update their own torrents
1 parent 50895ca commit 9a1b174

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

tests/e2e/web/api/v1/contexts/torrent/contract.rs

+33
Original file line numberDiff line numberDiff line change
@@ -1577,6 +1577,39 @@ mod and_admins {
15771577
let new_title = format!("{}-new-title", test_torrent.index_info.title);
15781578
let new_description = format!("{}-new-description", test_torrent.index_info.description);
15791579

1580+
let response = client
1581+
.update_torrent(
1582+
&test_torrent.file_info_hash(),
1583+
UpdateTorrentFrom {
1584+
title: Some(new_title.clone()),
1585+
description: Some(new_description.clone()),
1586+
category: None,
1587+
tags: None,
1588+
},
1589+
)
1590+
.await;
1591+
1592+
assert_eq!(response.status, 200);
1593+
}
1594+
#[tokio::test]
1595+
async fn it_should_allow_registered_users_to_update_their_own_torrents() {
1596+
let mut env = TestEnv::new();
1597+
env.start(api::Version::V1).await;
1598+
1599+
if !env.provides_a_tracker() {
1600+
println!("test skipped. It requires a tracker to be running.");
1601+
return;
1602+
}
1603+
1604+
let admin = new_logged_in_admin(&env).await;
1605+
1606+
let client = Client::authenticated(&env.server_socket_addr().unwrap(), &admin.token);
1607+
1608+
let (test_torrent, _uploaded_torrent) = upload_random_torrent_to_index(&admin, &env).await;
1609+
1610+
let new_title = format!("{}-new-title", test_torrent.index_info.title);
1611+
let new_description = format!("{}-new-description", test_torrent.index_info.description);
1612+
15801613
let response = client
15811614
.update_torrent(
15821615
&test_torrent.file_info_hash(),

0 commit comments

Comments
 (0)