Added unit test for /api/search
This commit is contained in:
parent
3f5a84ba8a
commit
cc17c6db97
2 changed files with 20 additions and 6 deletions
|
@ -359,7 +359,21 @@ fn recent() {
|
|||
|
||||
#[test]
|
||||
fn search() {
|
||||
// TODO
|
||||
let env = get_test_environment("api_search.sqlite");
|
||||
let client = &env.client;
|
||||
complete_initial_setup(client);
|
||||
do_auth(client);
|
||||
env.update_index();
|
||||
|
||||
let mut response = client.get("/api/search/door").dispatch();
|
||||
assert_eq!(response.status(), Status::Ok);
|
||||
let response_body = response.body_string().unwrap();
|
||||
let response_json: Vec<index::CollectionFile> = serde_json::from_str(&response_body).unwrap();
|
||||
assert_eq!(response_json.len(), 1);
|
||||
match response_json[0] {
|
||||
index::CollectionFile::Song(ref s) => assert_eq!(s.title, Some("Beyond The Door".into())),
|
||||
_ => panic!()
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue