refactor(server): change response to 'file deleted' (#137)

This commit is contained in:
Helmut K. C. Tessarek 2023-09-04 05:09:29 -04:00 committed by GitHub
parent 27e3be5a2d
commit cc9633cc95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -9,7 +9,7 @@ setup() {
run_test() {
file_url=$(curl -s -F "file=@file" localhost:8000)
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)"
}

View File

@ -176,7 +176,7 @@ async fn delete(
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
@ -788,6 +788,7 @@ mod tests {
let response = test::call_service(&app, request).await;
assert_eq!(StatusCode::OK, response.status());
assert_body(response.into_body(), "file deleted\n").await?;
let path = PathBuf::from(file_name);
assert!(!path.exists());