Added preferences API test

This commit is contained in:
Antoine Gersant 2020-09-24 22:14:40 -07:00
parent 42522ffc78
commit 7e46c6cd5a
2 changed files with 10 additions and 2 deletions

View file

@ -24,7 +24,7 @@ pub struct MiscSettings {
pub prefix_url: String,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct Preferences {
pub lastfm_username: Option<String>,
pub web_theme_base: Option<String>,

View file

@ -225,7 +225,15 @@ fn test_service_settings() {
#[test]
fn test_service_preferences() {
// TODO
let mut service = ServiceType::new(&format!("{}{}", TEST_DB_PREFIX, line!()));
service.complete_initial_setup();
service.login();
let response = service.get("/api/preferences");
assert_eq!(response.status(), StatusCode::OK);
let preferences = config::Preferences::default();
let response = service.put_json("/api/preferences", &preferences);
assert_eq!(response.status(), StatusCode::OK);
}
#[test]