pinakes-server: add more route tests

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Ief16a2b3181bfa50193fb69a5ad4a9166a6a6964
This commit is contained in:
raf 2026-03-21 15:32:59 +03:00
commit f1eacc8484
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
5 changed files with 295 additions and 8 deletions

View file

@ -7,6 +7,7 @@ use common::{
get_authed,
patch_json_authed,
post_json_authed,
put_json_authed,
response_body,
setup_app,
setup_app_with_auth,
@ -207,6 +208,22 @@ async fn get_user_libraries_requires_admin() {
assert_eq!(response.status(), StatusCode::FORBIDDEN);
}
// PUT coverage
#[tokio::test]
async fn update_sync_device_requires_editor() {
let (app, _, _, viewer_token) = setup_app_with_auth().await;
let response = app
.oneshot(put_json_authed(
"/api/v1/sync/devices/00000000-0000-0000-0000-000000000000",
r#"{"name":"device"}"#,
&viewer_token,
))
.await
.unwrap();
assert_eq!(response.status(), StatusCode::FORBIDDEN);
}
// No-auth coverage (exercises setup_app and get helpers)
#[tokio::test]