Don't make medias::tests::clean() panic when file not found

This commit is contained in:
Kitaiti Makoto 2022-01-10 22:04:57 +09:00
parent e1a598a459
commit 7d320e57da

View File

@ -400,7 +400,15 @@ pub(crate) mod tests {
pub(crate) fn clean(conn: &Conn) { pub(crate) fn clean(conn: &Conn) {
//used to remove files generated by tests //used to remove files generated by tests
for media in Media::list_all_medias(conn).unwrap() { for media in Media::list_all_medias(conn).unwrap() {
media.delete(conn).unwrap(); if let Some(err) = media.delete(conn).err() {
match &err {
Error::Io(e) => match e.kind() {
std::io::ErrorKind::NotFound => (),
_ => panic!("{:?}", err),
},
_ => panic!("{:?}", err),
}
}
} }
} }