mirror of
https://github.com/agersant/polaris
synced 2024-11-14 03:17:06 +00:00
More accurate teste for web client serving
This commit is contained in:
parent
a3f7a306e5
commit
8524c7d5fe
3 changed files with 11 additions and 3 deletions
|
@ -70,7 +70,7 @@ impl TestService for RocketTestService {
|
||||||
|
|
||||||
let context = service::ContextBuilder::new()
|
let context = service::ContextBuilder::new()
|
||||||
.database_file_path(db_path)
|
.database_file_path(db_path)
|
||||||
.web_dir_path(Path::new("web").into())
|
.web_dir_path(Path::new("test-data/web").into())
|
||||||
.swagger_dir_path(["docs", "swagger"].iter().collect())
|
.swagger_dir_path(["docs", "swagger"].iter().collect())
|
||||||
.cache_dir_path(["test-output", test_name].iter().collect())
|
.cache_dir_path(["test-output", test_name].iter().collect())
|
||||||
.build()
|
.build()
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
|
use http::StatusCode;
|
||||||
|
|
||||||
use crate::service::test::{ServiceType, TestService};
|
use crate::service::test::{ServiceType, TestService};
|
||||||
use crate::test_name;
|
use crate::test_name;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_web_can_get_index() {
|
fn test_serves_web_client() {
|
||||||
let mut service = ServiceType::new(&test_name!());
|
let mut service = ServiceType::new(&test_name!());
|
||||||
let request = service.request_builder().web_index();
|
let request = service.request_builder().web_index();
|
||||||
let _response = service.fetch_bytes(&request);
|
let response = service.fetch_bytes(&request);
|
||||||
|
assert_eq!(response.status(), StatusCode::OK);
|
||||||
}
|
}
|
||||||
|
|
5
test-data/web/index.html
Normal file
5
test-data/web/index.html
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<p>Example web client</p>
|
||||||
|
|
||||||
|
</html>
|
Loading…
Reference in a new issue