You've already forked AstralRinth
forked from didirus/AstralRinth
adds text, fixed problem (#808)
This commit is contained in:
@@ -9,7 +9,8 @@ use async_trait::async_trait;
|
||||
use bytes::Bytes;
|
||||
use chrono::{DateTime, Utc};
|
||||
use labrinth::{
|
||||
models::projects::Project, routes::v3::projects::ReturnSearchResults,
|
||||
models::{organizations::Organization, projects::Project},
|
||||
routes::v3::projects::ReturnSearchResults,
|
||||
util::actix::AppendsMultipart,
|
||||
};
|
||||
use rust_decimal::Decimal;
|
||||
@@ -483,6 +484,29 @@ impl ApiV3 {
|
||||
test::read_body_json(resp).await
|
||||
}
|
||||
|
||||
pub async fn get_project_organization(
|
||||
&self,
|
||||
id_or_slug: &str,
|
||||
pat: Option<&str>,
|
||||
) -> ServiceResponse {
|
||||
let req = test::TestRequest::get()
|
||||
.uri(&format!("/v3/project/{id_or_slug}/organization"))
|
||||
.append_pat(pat)
|
||||
.to_request();
|
||||
|
||||
self.call(req).await
|
||||
}
|
||||
|
||||
pub async fn get_project_organization_deserialized(
|
||||
&self,
|
||||
id_or_slug: &str,
|
||||
pat: Option<&str>,
|
||||
) -> Organization {
|
||||
let resp = self.get_project_organization(id_or_slug, pat).await;
|
||||
assert_eq!(resp.status(), 200);
|
||||
test::read_body_json(resp).await
|
||||
}
|
||||
|
||||
pub async fn search_deserialized(
|
||||
&self,
|
||||
query: Option<&str>,
|
||||
|
||||
@@ -84,6 +84,28 @@ async fn create_organization() {
|
||||
.await;
|
||||
}
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn get_project_organization() {
|
||||
with_test_environment(None, |test_env: TestEnvironment<ApiV3>| async move {
|
||||
let api = &test_env.api;
|
||||
let zeta_organization_id = &test_env.dummy.organization_zeta.organization_id;
|
||||
let alpha_project_id = &test_env.dummy.project_alpha.project_id;
|
||||
|
||||
// ADd alpha project to zeta organization
|
||||
let resp = api
|
||||
.organization_add_project(zeta_organization_id, alpha_project_id, USER_USER_PAT)
|
||||
.await;
|
||||
assert_eq!(resp.status(), 200);
|
||||
|
||||
// Get project organization
|
||||
let zeta = api
|
||||
.get_project_organization_deserialized(alpha_project_id, USER_USER_PAT)
|
||||
.await;
|
||||
assert_eq!(zeta.id.to_string(), zeta_organization_id.to_string());
|
||||
})
|
||||
.await;
|
||||
}
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn patch_organization() {
|
||||
with_test_environment(None, |test_env: TestEnvironment<ApiV3>| async move {
|
||||
|
||||
Reference in New Issue
Block a user