You've already forked AstralRinth
forked from didirus/AstralRinth
Fixes failing tests (#813)
* fixes failing tests * fmt clippy * updated dockerfile * fixes failing tests; adds important fix from extracts_versions PR * assert_eq -> assert_status, giving better error messages * fixed random failure bug * fmt, clippy, etc
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
use actix_http::StatusCode;
|
||||
use actix_web::{
|
||||
dev::ServiceResponse,
|
||||
test::{self, TestRequest},
|
||||
@@ -6,7 +7,10 @@ use bytes::Bytes;
|
||||
use labrinth::models::{collections::Collection, v3::projects::Project};
|
||||
use serde_json::json;
|
||||
|
||||
use crate::common::api_common::{request_data::ImageData, Api, AppendsOptionalPat};
|
||||
use crate::common::{
|
||||
api_common::{request_data::ImageData, Api, AppendsOptionalPat},
|
||||
asserts::assert_status,
|
||||
};
|
||||
|
||||
use super::ApiV3;
|
||||
|
||||
@@ -40,7 +44,7 @@ impl ApiV3 {
|
||||
|
||||
pub async fn get_collection_deserialized(&self, id: &str, pat: Option<&str>) -> Collection {
|
||||
let resp = self.get_collection(id, pat).await;
|
||||
assert_eq!(resp.status(), 200);
|
||||
assert_status(&resp, StatusCode::OK);
|
||||
test::read_body_json(resp).await
|
||||
}
|
||||
|
||||
@@ -70,7 +74,7 @@ impl ApiV3 {
|
||||
pat: Option<&str>,
|
||||
) -> Vec<Project> {
|
||||
let resp = self.get_collection_projects(id, pat).await;
|
||||
assert_eq!(resp.status(), 200);
|
||||
assert_status(&resp, StatusCode::OK);
|
||||
test::read_body_json(resp).await
|
||||
}
|
||||
|
||||
@@ -145,7 +149,7 @@ impl ApiV3 {
|
||||
pat: Option<&str>,
|
||||
) -> Vec<Collection> {
|
||||
let resp = self.get_user_collections(user_id_or_username, pat).await;
|
||||
assert_eq!(resp.status(), 200);
|
||||
assert_status(&resp, StatusCode::OK);
|
||||
// First, deserialize to the non-common format (to test the response is valid for this api version)
|
||||
let projects: Vec<Project> = test::read_body_json(resp).await;
|
||||
// Then, deserialize to the common format
|
||||
|
||||
Reference in New Issue
Block a user