diff options
author | Quentin <quentin@deuxfleurs.fr> | 2020-11-07 15:34:53 +0100 |
---|---|---|
committer | Quentin <quentin@deuxfleurs.fr> | 2020-11-07 15:34:53 +0100 |
commit | e1415f597631518f002080fe2016b6207b223f4f (patch) | |
tree | 45fe0e85522f4cd77b4d408830e52c77a114cbee /src/api | |
parent | 9a50ce12a8f334a306022921a4941a1ff37c8a8b (diff) | |
download | garage-e1415f597631518f002080fe2016b6207b223f4f.tar.gz garage-e1415f597631518f002080fe2016b6207b223f4f.zip |
Add a second test
Diffstat (limited to 'src/api')
-rw-r--r-- | src/api/api_server.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/api/api_server.rs b/src/api/api_server.rs index 507e6a9d..3f1c2f21 100644 --- a/src/api/api_server.rs +++ b/src/api/api_server.rs @@ -275,10 +275,21 @@ mod tests { use super::*; #[test] - fn parse_bucket_with_key() -> Result<(), Error> { + fn parse_bucket_containing_a_key() -> Result<(), Error> { let (bucket, key) = parse_bucket_key("/my_bucket/a/super/file.jpg")?; assert_eq!(bucket, "my_bucket"); assert_eq!(key.expect("key must be set"), "a/super/file.jpg"); Ok(()) + } + + #[test] + fn parse_bucket_containing_no_key() -> Result<(), Error> { + let (bucket, key) = parse_bucket_key("/my_bucket/")?; + assert_eq!(bucket, "my_bucket"); + assert!(key.is_none()); + let (bucket, key) = parse_bucket_key("/my_bucket")?; + assert_eq!(bucket, "my_bucket"); + assert!(key.is_none()); + Ok(()) } } |