Beispiel #1
0
    public void TestAddBucketOwner()
    {
        AddBucketOwnerSample    addBucketOwnerSample    = new AddBucketOwnerSample();
        RemoveBucketOwnerSample removeBucketOwnerSample = new RemoveBucketOwnerSample();

        // Add bucket owner.
        var result = addBucketOwnerSample.AddBucketOwner(_fixture.BucketNameGeneric, _fixture.ServiceAccountEmail);

        Assert.Contains(result.Acl, c => c.Role == "OWNER" && c.Email == _fixture.ServiceAccountEmail);
        _fixture.SleepAfterBucketCreateUpdateDelete();

        // Remove bucket owner.
        removeBucketOwnerSample.RemoveBucketOwner(_fixture.BucketNameGeneric, _fixture.ServiceAccountEmail);
        _fixture.SleepAfterBucketCreateUpdateDelete();
    }
    public void TestRemoveBucketOwner()
    {
        AddBucketOwnerSample    addBucketOwnerSample    = new AddBucketOwnerSample();
        RemoveBucketOwnerSample removeBucketOwnerSample = new RemoveBucketOwnerSample();
        GetBucketMetadataSample getBucketMetadataSample = new GetBucketMetadataSample();

        // Add bucket owner.
        addBucketOwnerSample.AddBucketOwner(_bucketFixture.BucketNameGeneric, _bucketFixture.ServiceAccountEmail);
        _bucketFixture.SleepAfterBucketCreateUpdateDelete();

        // Remove bucket owner.
        removeBucketOwnerSample.RemoveBucketOwner(_bucketFixture.BucketNameGeneric, _bucketFixture.ServiceAccountEmail);
        _bucketFixture.SleepAfterBucketCreateUpdateDelete();

        // Get bucket metadata.
        var bucketMetadata = getBucketMetadataSample.GetBucketMetadata(_bucketFixture.BucketNameGeneric);

        Assert.DoesNotContain(bucketMetadata.Acl, acl => acl.Role == "OWNER" && acl.Email == _bucketFixture.ServiceAccountEmail);
    }
    public void TestPrintBucketAclForUser()
    {
        PrintBucketAclForUserSample printBucketAclForUserSample = new PrintBucketAclForUserSample();
        AddBucketOwnerSample        addBucketOwnerSample        = new AddBucketOwnerSample();
        RemoveBucketOwnerSample     removeBucketOwnerSample     = new RemoveBucketOwnerSample();
        string userEmail = _bucketFixture.ServiceAccountEmail;

        // Add bucket owner
        addBucketOwnerSample.AddBucketOwner(_bucketFixture.BucketNameGeneric, userEmail);
        _bucketFixture.SleepAfterBucketCreateUpdateDelete();

        var bucketAclForUser = printBucketAclForUserSample.PrintBucketAclForUser(_bucketFixture.BucketNameGeneric, userEmail);

        Assert.All(bucketAclForUser, c => Assert.Equal(c.Email, userEmail));

        // Remove bucket owner
        removeBucketOwnerSample.RemoveBucketOwner(_bucketFixture.BucketNameGeneric, userEmail);
        _bucketFixture.SleepAfterBucketCreateUpdateDelete();
    }
Beispiel #4
0
    public void TestPrintBucketAcl()
    {
        PrintBucketAclSample    printBucketAclSample    = new PrintBucketAclSample();
        AddBucketOwnerSample    addBucketOwnerSample    = new AddBucketOwnerSample();
        RemoveBucketOwnerSample removeBucketOwnerSample = new RemoveBucketOwnerSample();
        string userEmail = _fixture.ServiceAccountEmail;

        // print bucket acl
        var bucketAcl = printBucketAclSample.PrintBucketAcl(_fixture.BucketNameGeneric);

        Assert.DoesNotContain(bucketAcl, c => c.Email == userEmail);

        // add bucket owner
        addBucketOwnerSample.AddBucketOwner(_fixture.BucketNameGeneric, userEmail);
        _fixture.SleepAfterBucketCreateUpdateDelete();

        // print bucket acl
        bucketAcl = printBucketAclSample.PrintBucketAcl(_fixture.BucketNameGeneric);
        Assert.Contains(bucketAcl, c => c.Email == userEmail);

        // remove owner.
        removeBucketOwnerSample.RemoveBucketOwner(_fixture.BucketNameGeneric, userEmail);
        _fixture.SleepAfterBucketCreateUpdateDelete();
    }