mirror of
https://codeberg.org/demostf/api-test.git
synced 2026-11-30 04:00:49 +01:00
add test for name normalization
This commit is contained in:
parent
9e8438e6a3
commit
0e296b3f99
1 changed files with 45 additions and 0 deletions
45
src/main.rs
45
src/main.rs
|
|
@ -661,6 +661,51 @@ async fn main() -> Result<()> {
|
|||
})
|
||||
.await;
|
||||
|
||||
success &= Test::run("Unusual uploads", &harness, |test| async move {
|
||||
let id = test
|
||||
.step("upload demo with directory prefix", |client| async move {
|
||||
Ok(client
|
||||
.upload_demo(
|
||||
String::from("demos/test.dem"),
|
||||
granary_data.to_vec(),
|
||||
String::from("RED"),
|
||||
String::from("BLUE"),
|
||||
String::from("token"),
|
||||
)
|
||||
.await?)
|
||||
})
|
||||
.await?;
|
||||
|
||||
test.step("name is stripped", |client| async move {
|
||||
let demo = client.get(id).await?;
|
||||
assert_eq(demo.name, "test.dem")
|
||||
})
|
||||
.await?;
|
||||
|
||||
let id = test
|
||||
.step("upload demo with percent", |client| async move {
|
||||
Ok(client
|
||||
.upload_demo(
|
||||
String::from("test%foo.dem"),
|
||||
process_data.to_vec(),
|
||||
String::from("RED"),
|
||||
String::from("BLUE"),
|
||||
String::from("token"),
|
||||
)
|
||||
.await?)
|
||||
})
|
||||
.await?;
|
||||
|
||||
test.step("name is normalized", |client| async move {
|
||||
let demo = client.get(id).await?;
|
||||
assert_eq(demo.name, "test_foo.dem")
|
||||
})
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
})
|
||||
.await;
|
||||
|
||||
if !success {
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue