refactor(server): change response to 'file deleted' (#137)
This commit is contained in:
parent
27e3be5a2d
commit
cc9633cc95
|
@ -9,7 +9,7 @@ setup() {
|
||||||
run_test() {
|
run_test() {
|
||||||
file_url=$(curl -s -F "file=@file" localhost:8000)
|
file_url=$(curl -s -F "file=@file" localhost:8000)
|
||||||
test "$file_url" = "http://localhost:8000/file.txt"
|
test "$file_url" = "http://localhost:8000/file.txt"
|
||||||
test "the file is deleted" = "$(curl -s -H "Authorization: may_the_force_be_with_you" -X DELETE http://localhost:8000/file.txt)"
|
test "file deleted" = "$(curl -s -H "Authorization: may_the_force_be_with_you" -X DELETE http://localhost:8000/file.txt)"
|
||||||
test "file is not found or expired :(" = "$(curl -s -H "Authorization: may_the_force_be_with_you" -X DELETE http://localhost:8000/file.txt)"
|
test "file is not found or expired :(" = "$(curl -s -H "Authorization: may_the_force_be_with_you" -X DELETE http://localhost:8000/file.txt)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -176,7 +176,7 @@ async fn delete(
|
||||||
return Err(error::ErrorInternalServerError("cannot delete file"));
|
return Err(error::ErrorInternalServerError("cannot delete file"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(HttpResponse::Ok().body(String::from("the file is deleted\n")))
|
Ok(HttpResponse::Ok().body(String::from("file deleted\n")))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Expose version endpoint
|
/// Expose version endpoint
|
||||||
|
@ -788,6 +788,7 @@ mod tests {
|
||||||
let response = test::call_service(&app, request).await;
|
let response = test::call_service(&app, request).await;
|
||||||
|
|
||||||
assert_eq!(StatusCode::OK, response.status());
|
assert_eq!(StatusCode::OK, response.status());
|
||||||
|
assert_body(response.into_body(), "file deleted\n").await?;
|
||||||
|
|
||||||
let path = PathBuf::from(file_name);
|
let path = PathBuf::from(file_name);
|
||||||
assert!(!path.exists());
|
assert!(!path.exists());
|
||||||
|
|
Loading…
Reference in New Issue