pinakes-server: expand test coverage for server features
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Ia09d2d3ad7f6613e21d20321e0877bc16a6a6964
This commit is contained in:
parent
4a2136439f
commit
7d8ec5ffc1
8 changed files with 853 additions and 10 deletions
|
|
@ -3,7 +3,19 @@ use axum::{
|
|||
body::Body,
|
||||
http::{Request, StatusCode},
|
||||
};
|
||||
use common::*;
|
||||
use common::{
|
||||
delete_authed,
|
||||
get,
|
||||
get_authed,
|
||||
patch_json_authed,
|
||||
post_json,
|
||||
post_json_authed,
|
||||
put_json_authed,
|
||||
response_body,
|
||||
setup_app,
|
||||
setup_app_with_auth,
|
||||
test_addr,
|
||||
};
|
||||
use http_body_util::BodyExt;
|
||||
use tower::ServiceExt;
|
||||
|
||||
|
|
@ -708,3 +720,19 @@ async fn test_share_link_expired() {
|
|||
|| response.status() == StatusCode::INTERNAL_SERVER_ERROR
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_update_sync_device_requires_editor() {
|
||||
let (app, _, _, viewer_token) = setup_app_with_auth().await;
|
||||
let fake_id = uuid::Uuid::now_v7();
|
||||
let response = app
|
||||
.clone()
|
||||
.oneshot(put_json_authed(
|
||||
&format!("/api/v1/sync/devices/{fake_id}"),
|
||||
r#"{"name":"renamed"}"#,
|
||||
&viewer_token,
|
||||
))
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(response.status(), StatusCode::FORBIDDEN);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue