summaryrefslogtreecommitdiff
path: root/tests/integration/not_found.rs
blob: a86d57054b8b31f55e133a0563319161791bf488 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::harness::{TestServer, test_config};

#[tokio::test]
async fn unknown_site_returns_404() {
    let server = TestServer::start(test_config(tempfile::tempdir().unwrap().keep())).await;

    let resp = TestServer::client()
        .post(server.url("/nonexistent"))
        .send()
        .await
        .unwrap();

    assert_eq!(resp.status().as_u16(), 404);
    let body = resp.text().await.unwrap();
    let json: serde_json::Value = serde_json::from_str(&body).unwrap();
    assert_eq!(json["error"], "not_found");
}