You've already forked AstralRinth
forked from didirus/AstralRinth
Organization ownership (#796)
* organization changes * changes * fixes failing test * version changes * removed printlns * add_team_member comes pre-accepted * no notification on force accept * fixes tests * merge fixes
This commit is contained in:
@@ -3,7 +3,7 @@ use actix_web::{
|
||||
test::{self, TestRequest},
|
||||
};
|
||||
use bytes::Bytes;
|
||||
use labrinth::models::{organizations::Organization, v3::projects::Project};
|
||||
use labrinth::models::{organizations::Organization, users::UserId, v3::projects::Project};
|
||||
use serde_json::json;
|
||||
|
||||
use crate::common::api_common::{request_data::ImageData, Api, AppendsOptionalPat};
|
||||
@@ -162,12 +162,16 @@ impl ApiV3 {
|
||||
&self,
|
||||
id_or_title: &str,
|
||||
project_id_or_slug: &str,
|
||||
new_owner_user_id: UserId,
|
||||
pat: Option<&str>,
|
||||
) -> ServiceResponse {
|
||||
let req = test::TestRequest::delete()
|
||||
.uri(&format!(
|
||||
"/v3/organization/{id_or_title}/projects/{project_id_or_slug}"
|
||||
))
|
||||
.set_json(json!({
|
||||
"new_owner": new_owner_user_id,
|
||||
}))
|
||||
.append_pat(pat)
|
||||
.to_request();
|
||||
|
||||
|
||||
@@ -37,6 +37,16 @@ impl ApiV3 {
|
||||
assert_eq!(resp.status(), 200);
|
||||
test::read_body_json(resp).await
|
||||
}
|
||||
|
||||
pub async fn get_project_members_deserialized(
|
||||
&self,
|
||||
project_id: &str,
|
||||
pat: Option<&str>,
|
||||
) -> Vec<TeamMember> {
|
||||
let resp = self.get_project_members(project_id, pat).await;
|
||||
assert_eq!(resp.status(), 200);
|
||||
test::read_body_json(resp).await
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait(?Send)]
|
||||
|
||||
@@ -1051,8 +1051,10 @@ async fn add_user_to_team(
|
||||
assert!(resp.status().is_success());
|
||||
|
||||
// Accept invitation
|
||||
let resp = setup_api.join_team(team_id, user_pat).await;
|
||||
assert!(resp.status().is_success());
|
||||
setup_api.join_team(team_id, user_pat).await;
|
||||
// This does not check if the join request was successful,
|
||||
// as the join is not always needed- an org project + in-org invite
|
||||
// will automatically go through.
|
||||
}
|
||||
|
||||
async fn modify_user_team_permissions(
|
||||
|
||||
Reference in New Issue
Block a user