update tests & fix the broken code

This commit is contained in:
Quentin de Quelen
2020-04-16 11:09:47 +02:00
committed by qdequele
parent 5e2861ff55
commit 27b3b53bc5
17 changed files with 554 additions and 555 deletions

View File

@ -3,36 +3,36 @@ use std::convert::Into;
mod common;
#[test]
fn test_healthyness() {
#[actix_rt::test]
async fn test_healthyness() {
let mut server = common::Server::with_uid("movies");
// Check that the server is healthy
let (_response, status_code) = server.get_health();
let (_response, status_code) = server.get_health().await;
assert_eq!(status_code, 200);
// Set the serve Unhealthy
let body = json!({
"health": false,
});
let (_response, status_code) = server.update_health(body);
let (_response, status_code) = server.update_health(body).await;
assert_eq!(status_code, 200);
// Check that the server is unhealthy
let (_response, status_code) = server.get_health();
let (_response, status_code) = server.get_health().await;
assert_eq!(status_code, 503);
// Set the server healthy
let body = json!({
"health": true,
});
let (_response, status_code) = server.update_health(body);
let (_response, status_code) = server.update_health(body).await;
assert_eq!(status_code, 200);
// Check if the server is healthy
let (_response, status_code) = server.get_health();
let (_response, status_code) = server.get_health().await;
assert_eq!(status_code, 200);
}