mirror of
https://codeberg.org/demostf/api-test.git
synced 2026-06-03 17:44:07 +02:00
status code on failure
This commit is contained in:
parent
bcd2169ff0
commit
ac115dedbf
2 changed files with 14 additions and 6 deletions
14
src/main.rs
14
src/main.rs
|
|
@ -31,7 +31,9 @@ async fn main() -> Result<()> {
|
|||
let edit_key = dotenv::var("EDIT_KEY")?;
|
||||
let edit_key = &edit_key;
|
||||
|
||||
Test::run(
|
||||
let mut success = true;
|
||||
|
||||
success &= Test::run(
|
||||
"Upload with invalid credentials",
|
||||
&harness,
|
||||
|test| async move {
|
||||
|
|
@ -61,7 +63,7 @@ async fn main() -> Result<()> {
|
|||
)
|
||||
.await;
|
||||
|
||||
Test::run(
|
||||
success &= Test::run(
|
||||
"Upload demo, then retrieve info",
|
||||
&harness,
|
||||
|test| async move {
|
||||
|
|
@ -157,7 +159,7 @@ async fn main() -> Result<()> {
|
|||
)
|
||||
.await;
|
||||
|
||||
Test::run("Listings", &harness, |test| async move {
|
||||
success &= Test::run("Listings", &harness, |test| async move {
|
||||
test.step("upload", |client| async move {
|
||||
client
|
||||
.upload_demo(
|
||||
|
|
@ -334,7 +336,7 @@ async fn main() -> Result<()> {
|
|||
})
|
||||
.await;
|
||||
|
||||
Test::run("Set url", &harness, |test| async move {
|
||||
success &= Test::run("Set url", &harness, |test| async move {
|
||||
let id = test
|
||||
.step("upload", |client| async move {
|
||||
Ok(client
|
||||
|
|
@ -452,6 +454,10 @@ async fn main() -> Result<()> {
|
|||
})
|
||||
.await;
|
||||
|
||||
if !success {
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,13 +15,13 @@ impl Test {
|
|||
name: &str,
|
||||
harness: &'a Harness,
|
||||
f: F,
|
||||
) {
|
||||
) -> bool {
|
||||
println!(" - {}", name);
|
||||
|
||||
if let Err(e) = harness.reset().await {
|
||||
println!(" {}: {:#}", "Reset api server".red(), e);
|
||||
println!(" {}", "❌".red());
|
||||
return;
|
||||
return false;
|
||||
} else {
|
||||
println!(" - {}", "Reset api server".green());
|
||||
}
|
||||
|
|
@ -33,9 +33,11 @@ impl Test {
|
|||
match f(test).await {
|
||||
Ok(_) => {
|
||||
println!(" {}", "✓".green());
|
||||
true
|
||||
}
|
||||
Err(e) => {
|
||||
println!(" {}: {:#}", "❌".red(), e);
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue