Remobed blanket import
This commit is contained in:
parent
76118756b9
commit
9ed0526075
1 changed files with 16 additions and 14 deletions
|
@ -5,7 +5,7 @@ use crate::service::dto;
|
||||||
use crate::vfs;
|
use crate::vfs;
|
||||||
|
|
||||||
#[cfg(feature = "service-rocket")]
|
#[cfg(feature = "service-rocket")]
|
||||||
pub use crate::service::rocket::test::*;
|
pub use crate::service::rocket::test;
|
||||||
|
|
||||||
const TEST_USERNAME: &str = "test_user";
|
const TEST_USERNAME: &str = "test_user";
|
||||||
const TEST_PASSWORD: &str = "test_password";
|
const TEST_PASSWORD: &str = "test_password";
|
||||||
|
@ -15,25 +15,25 @@ const TEST_MOUNT_SOURCE: &str = "test/collection";
|
||||||
#[named]
|
#[named]
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_index() {
|
async fn test_index() {
|
||||||
let mut service = make_service(function_name!()).await;
|
let mut service = test::make_service(function_name!()).await;
|
||||||
get(&mut service, "/").await;
|
test::get(&mut service, "/").await;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[named]
|
#[named]
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_swagger_index() {
|
async fn test_swagger_index() {
|
||||||
let mut service = make_service(function_name!()).await;
|
let mut service = test::make_service(function_name!()).await;
|
||||||
get(&mut service, "/swagger").await;
|
test::get(&mut service, "/swagger").await;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[named]
|
#[named]
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_swagger_index_with_trailing_slash() {
|
async fn test_swagger_index_with_trailing_slash() {
|
||||||
let mut service = make_service(function_name!()).await;
|
let mut service = test::make_service(function_name!()).await;
|
||||||
get(&mut service, "/swagger/").await;
|
test::get(&mut service, "/swagger/").await;
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn complete_initial_setup(service: &mut ServiceType) {
|
async fn complete_initial_setup(service: &mut test::ServiceType) {
|
||||||
let configuration = config::Config {
|
let configuration = config::Config {
|
||||||
album_art_pattern: None,
|
album_art_pattern: None,
|
||||||
prefix_url: None,
|
prefix_url: None,
|
||||||
|
@ -49,24 +49,25 @@ async fn complete_initial_setup(service: &mut ServiceType) {
|
||||||
source: TEST_MOUNT_SOURCE.into(),
|
source: TEST_MOUNT_SOURCE.into(),
|
||||||
}]),
|
}]),
|
||||||
};
|
};
|
||||||
put_json(service, "/api/settings", &configuration).await;
|
test::put_json(service, "/api/settings", &configuration).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[named]
|
#[named]
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_version() {
|
async fn test_version() {
|
||||||
let mut service = make_service(function_name!()).await;
|
let mut service = test::make_service(function_name!()).await;
|
||||||
let version: dto::Version = get_json(&mut service, "/api/version").await;
|
let version: dto::Version = test::get_json(&mut service, "/api/version").await;
|
||||||
assert_eq!(version, dto::Version { major: 4, minor: 0 });
|
assert_eq!(version, dto::Version { major: 4, minor: 0 });
|
||||||
}
|
}
|
||||||
|
|
||||||
#[named]
|
#[named]
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_initial_setup() {
|
async fn test_initial_setup() {
|
||||||
let mut service = make_service(function_name!()).await;
|
let mut service = test::make_service(function_name!()).await;
|
||||||
|
|
||||||
{
|
{
|
||||||
let initial_setup: dto::InitialSetup = get_json(&mut service, "/api/initial_setup").await;
|
let initial_setup: dto::InitialSetup =
|
||||||
|
test::get_json(&mut service, "/api/initial_setup").await;
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
initial_setup,
|
initial_setup,
|
||||||
dto::InitialSetup {
|
dto::InitialSetup {
|
||||||
|
@ -78,7 +79,8 @@ async fn test_initial_setup() {
|
||||||
complete_initial_setup(&mut service).await;
|
complete_initial_setup(&mut service).await;
|
||||||
|
|
||||||
{
|
{
|
||||||
let initial_setup: dto::InitialSetup = get_json(&mut service, "/api/initial_setup").await;
|
let initial_setup: dto::InitialSetup =
|
||||||
|
test::get_json(&mut service, "/api/initial_setup").await;
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
initial_setup,
|
initial_setup,
|
||||||
dto::InitialSetup {
|
dto::InitialSetup {
|
||||||
|
|
Loading…
Add table
Reference in a new issue