mirror of
https://git.deuxfleurs.fr/Deuxfleurs/garage.git
synced 2024-11-14 04:01:25 +00:00
Fix bucket creation tests to take permissions into account
This commit is contained in:
parent
2ac75018a1
commit
0e61e3b6fb
2 changed files with 30 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
use crate::common;
|
||||
use crate::common::ext::CommandExt;
|
||||
use aws_sdk_s3::model::BucketLocationConstraint;
|
||||
use aws_sdk_s3::output::DeleteBucketOutput;
|
||||
|
||||
|
@ -8,6 +9,27 @@ async fn test_bucket_all() {
|
|||
let bucket_name = "hello";
|
||||
|
||||
{
|
||||
// Check bucket cannot be created if not authorized
|
||||
ctx.garage
|
||||
.command()
|
||||
.args(["key", "deny"])
|
||||
.args(["--create-bucket", &ctx.garage.key.id])
|
||||
.quiet()
|
||||
.expect_success_output("Could not deny key to create buckets");
|
||||
|
||||
// Try create bucket, should fail
|
||||
let r = ctx.client.create_bucket().bucket(bucket_name).send().await;
|
||||
assert!(r.is_err());
|
||||
}
|
||||
{
|
||||
// Now allow key to create bucket
|
||||
ctx.garage
|
||||
.command()
|
||||
.args(["key", "allow"])
|
||||
.args(["--create-bucket", &ctx.garage.key.id])
|
||||
.quiet()
|
||||
.expect_success_output("Could not deny key to create buckets");
|
||||
|
||||
// Create bucket
|
||||
//@TODO check with an invalid bucket name + with an already existing bucket
|
||||
let r = ctx
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use crate::common;
|
||||
use crate::common::ext::CommandExt;
|
||||
use common::custom_requester::BodySignature;
|
||||
use hyper::Method;
|
||||
|
||||
|
@ -105,6 +106,13 @@ async fn test_create_bucket_streaming() {
|
|||
let ctx = common::context();
|
||||
let bucket = "createbucket-streaming";
|
||||
|
||||
ctx.garage
|
||||
.command()
|
||||
.args(["key", "allow"])
|
||||
.args(["--create-bucket", &ctx.garage.key.id])
|
||||
.quiet()
|
||||
.expect_success_output("Could not allow key to create buckets");
|
||||
|
||||
{
|
||||
// create bucket
|
||||
let _ = ctx
|
||||
|
|
Loading…
Reference in a new issue