add test for name normalization

This commit is contained in:
Robin Appelman 2026-10-24 18:38:54 +02:00
commit 0e296b3f99
Signed by: robin
SSH key fingerprint: SHA256:kifqgrqnut7q1YUIrI0AdMNC23qiKAS/T9uGFmIYvbE

View file

@ -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);
}