Modrinth/tests/error.rs
Wyatt Verchere a70df067bc
Misc v3 linear tasks (#767)
* v3_reroute 404 error

* hash change

* fixed issue with error conversion

* added new model confirmation tests
+ title name change

* renaming, fields

* owner; test changes

* clippy prepare

* fmt

* merge fixes

* clippy

* working merge

* revs

* merge fixes
2023-12-01 20:15:00 -07:00

24 lines
735 B
Rust

use actix_web::test;
use bytes::Bytes;
use common::api_common::ApiProject;
use common::api_v3::ApiV3;
use common::database::USER_USER_PAT;
use common::environment::{with_test_environment, TestEnvironment};
mod common;
#[actix_rt::test]
pub async fn error_404_body() {
with_test_environment(None, |test_env: TestEnvironment<ApiV3>| async move {
// 3 errors should have 404 as non-blank body, for missing resources
let api = &test_env.api;
let resp = api.get_project("does-not-exist", USER_USER_PAT).await;
assert_eq!(resp.status(), 404);
let body = test::read_body(resp).await;
let empty_bytes = Bytes::from_static(b"");
assert_ne!(body, empty_bytes);
})
.await;
}