restore version route

This commit is contained in:
mpostma 2021-03-15 19:08:19 +01:00
parent 0c17b166df
commit 6a742ee62c
No known key found for this signature in database
GPG key ID: CBC8A7C1D7A28C3A
6 changed files with 24 additions and 3 deletions

View file

@ -69,4 +69,8 @@ impl Server {
pub async fn list_indexes(&self) -> (Value, StatusCode) {
self.service.get("/indexes").await
}
pub async fn version(&self) -> (Value, StatusCode) {
self.service.get("/version").await
}
}

View file

@ -4,6 +4,7 @@ mod index;
mod search;
mod settings;
mod updates;
mod stats;
// Tests are isolated by features in different modules to allow better readability, test
// targetability, and improved incremental compilation times.

View file

@ -0,0 +1,12 @@
use crate::common::Server;
#[actix_rt::test]
async fn get_settings_unexisting_index() {
let server = Server::new().await;
let (response, code) = server.version().await;
assert_eq!(code, 200);
let version = response.as_object().unwrap();
assert!(version.get("commitSha").is_some());
assert!(version.get("buildDate").is_some());
assert!(version.get("pkgVersion").is_some());
}