more games information, games route (#756)

* more games information, games route

* adds banner url
This commit is contained in:
Wyatt Verchere
2023-11-14 10:01:31 -08:00
committed by GitHub
parent 375f992a0c
commit f4880d0519
19 changed files with 206 additions and 45 deletions

View File

@@ -6,6 +6,7 @@ use std::rc::Rc;
pub mod oauth;
pub mod oauth_clients;
pub mod tags;
#[derive(Clone)]
pub struct ApiV3 {

View File

@@ -0,0 +1,26 @@
use actix_web::{
dev::ServiceResponse,
test::{self, TestRequest},
};
use labrinth::routes::v3::tags::GameData;
use crate::common::database::ADMIN_USER_PAT;
use super::ApiV3;
impl ApiV3 {
// TODO: fold this into v3 API of other v3 testing PR
pub async fn get_games(&self) -> ServiceResponse {
let req = TestRequest::get()
.uri("/v3/games")
.append_header(("Authorization", ADMIN_USER_PAT))
.to_request();
self.call(req).await
}
pub async fn get_games_deserialized(&self) -> Vec<GameData> {
let resp = self.get_games().await;
assert_eq!(resp.status(), 200);
test::read_body_json(resp).await
}
}