You've already forked AstralRinth
forked from didirus/AstralRinth
Move charges to DB + fix subscription recurring payments (#971)
* Move charges to DB + fix subscription recurring payments * Finish most + pyro integration * Finish billing * Run prepare * Fix intervals * Fix clippy * Remove unused test
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user