Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
Remove unused test
Browse files Browse the repository at this point in the history
  • Loading branch information
Geometrically committed Oct 10, 2024
1 parent 9b068d4 commit 61bc0d9
Showing 1 changed file with 0 additions and 88 deletions.
88 changes: 0 additions & 88 deletions tests/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,94 +579,6 @@ pub async fn test_bulk_edit_links() {
.await;
}

#[actix_rt::test]
async fn delete_project_with_report() {
with_test_environment(None, |test_env: TestEnvironment<ApiV3>| async move {
let api = &test_env.api;
let alpha_project_id: &str = &test_env.dummy.project_alpha.project_id;
let beta_project_id: &str = &test_env.dummy.project_beta.project_id;

// Create a report for the project
let resp = api
.create_report(
"copyright",
alpha_project_id,
CommonItemType::Project,
"Hey! This is my project, copied without permission!",
ENEMY_USER_PAT, // Enemy makes a report
)
.await;
assert_status!(&resp, StatusCode::OK);
let value = test::read_body_json::<serde_json::Value, _>(resp).await;
let alpha_report_id = value["id"].as_str().unwrap();

// Confirm existence
let resp = api
.get_report(
alpha_report_id,
ENEMY_USER_PAT, // Enemy makes a report
)
.await;
assert_status!(&resp, StatusCode::OK);

// Do the same for beta
let resp = api
.create_report(
"copyright",
beta_project_id,
CommonItemType::Project,
"Hey! This is my project, copied without permission!",
ENEMY_USER_PAT, // Enemy makes a report
)
.await;
assert_status!(&resp, StatusCode::OK);
let value = test::read_body_json::<serde_json::Value, _>(resp).await;
let beta_report_id = value["id"].as_str().unwrap();

// Delete the project
let resp = api.remove_project(alpha_project_id, USER_USER_PAT).await;
assert_status!(&resp, StatusCode::NO_CONTENT);

// Confirm that the project is gone from the cache
let mut redis_pool = test_env.db.redis_pool.connect().await.unwrap();
assert_eq!(
redis_pool
.get(PROJECTS_SLUGS_NAMESPACE, "demo")
.await
.unwrap()
.and_then(|x| x.parse::<i64>().ok()),
None
);
assert_eq!(
redis_pool
.get(PROJECTS_SLUGS_NAMESPACE, alpha_project_id)
.await
.unwrap()
.and_then(|x| x.parse::<i64>().ok()),
None
);

// Report for alpha no longer exists
let resp = api
.get_report(
alpha_report_id,
ENEMY_USER_PAT, // Enemy makes a report
)
.await;
assert_status!(&resp, StatusCode::NOT_FOUND);

// Confirm that report for beta still exists
let resp = api
.get_report(
beta_report_id,
ENEMY_USER_PAT, // Enemy makes a report
)
.await;
assert_status!(&resp, StatusCode::OK);
})
.await;
}

#[actix_rt::test]
async fn permissions_patch_project_v3() {
with_test_environment(Some(8), |test_env: TestEnvironment<ApiV3>| async move {
Expand Down

0 comments on commit 61bc0d9

Please sign in to comment.