mirror of
https://git.deuxfleurs.fr/Deuxfleurs/garage.git
synced 2024-11-21 23:51:00 +00:00
add test for create bucket and put website with streaming signature
This commit is contained in:
parent
1eb7fdb08f
commit
8db6b84559
1 changed files with 84 additions and 0 deletions
|
@ -99,3 +99,87 @@ async fn test_putobject_streaming() {
|
|||
assert_eq!(o.tag_count, 0);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_create_bucket_streaming() {
|
||||
let ctx = common::context();
|
||||
let bucket = "createbucket-streaming";
|
||||
|
||||
{
|
||||
// create bucket
|
||||
let _ = ctx
|
||||
.custom_request
|
||||
.builder(bucket.to_owned())
|
||||
.method(Method::PUT)
|
||||
.body_signature(BodySignature::Streaming(10))
|
||||
.send()
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
// test if the bucket exists and works properly
|
||||
let etag = "\"d41d8cd98f00b204e9800998ecf8427e\"";
|
||||
let content_type = "text/csv";
|
||||
let _ = ctx
|
||||
.client
|
||||
.put_object()
|
||||
.bucket(bucket)
|
||||
.key(STD_KEY)
|
||||
.content_type(content_type)
|
||||
.send()
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let o = ctx
|
||||
.client
|
||||
.get_object()
|
||||
.bucket(bucket)
|
||||
.key(STD_KEY)
|
||||
.send()
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(o.e_tag.unwrap(), etag);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_put_website_streaming() {
|
||||
let ctx = common::context();
|
||||
let bucket = ctx.create_bucket("putwebsite-streaming");
|
||||
|
||||
{
|
||||
let website_config = r#"<?xml version="1.0" encoding="UTF-8"?>
|
||||
<WebsiteConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
|
||||
<ErrorDocument>
|
||||
<Key>err/error.html</Key>
|
||||
</ErrorDocument>
|
||||
<IndexDocument>
|
||||
<Suffix>home.html</Suffix>
|
||||
</IndexDocument>
|
||||
</WebsiteConfiguration>"#;
|
||||
|
||||
let mut query = HashMap::new();
|
||||
query.insert("website".to_owned(), None);
|
||||
let _ = ctx
|
||||
.custom_request
|
||||
.builder(bucket.clone())
|
||||
.method(Method::PUT)
|
||||
.query_params(query)
|
||||
.body(website_config.as_bytes().to_vec())
|
||||
.body_signature(BodySignature::Streaming(10))
|
||||
.send()
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let o = ctx
|
||||
.client
|
||||
.get_bucket_website()
|
||||
.bucket(&bucket)
|
||||
.send()
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(o.index_document.unwrap().suffix.unwrap(), "home.html");
|
||||
assert_eq!(o.error_document.unwrap().key.unwrap(), "err/error.html");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue