public void TestDeleteHmacKey()
    {
        CreateHmacKeySample     createHmacKeySample     = new CreateHmacKeySample();
        GetHmacKeySample        getHmacKeySample        = new GetHmacKeySample();
        DeactivateHmacKeySample deactivateHmacKeySample = new DeactivateHmacKeySample();
        DeleteHmacKeySample     deleteHmacKeySample     = new DeleteHmacKeySample();

        string serviceAccountEmail = _fixture.GetServiceAccountEmail();

        // Create key.
        var key = createHmacKeySample.CreateHmacKey(_fixture.ProjectId, serviceAccountEmail);

        _accessId = key.Metadata.AccessId;

        // Deactivate key.
        _fixture.HmacChangesPropagated.Eventually(() => deactivateHmacKeySample.DeactivateHmacKey(_fixture.ProjectId, _accessId));
        _isActive = false;

        // Delete key.
        _fixture.HmacChangesPropagated.Eventually(() => deleteHmacKeySample.DeleteHmacKey(_fixture.ProjectId, _accessId));

        // Get key.
        _fixture.HmacChangesPropagated.Eventually(() =>
        {
            var keyMetadata = getHmacKeySample.GetHmacKey(_fixture.ProjectId, _accessId);
            Assert.Equal("DELETED", keyMetadata.State);
        });
        _accessId = null;
    }
Пример #2
0
    public void TestCreateHmacKey()
    {
        CreateHmacKeySample createHmacKeySample = new CreateHmacKeySample();
        string serviceAccountEmail = _bucketFixture.GetServiceAccountEmail();

        // Create key.
        var key = createHmacKeySample.CreateHmacKey(_bucketFixture.ProjectId, serviceAccountEmail);

        _accessId = key.Metadata.AccessId;
        Assert.Equal(key.Metadata.ServiceAccountEmail, serviceAccountEmail);
    }
    public void TestGetHmacKey()
    {
        CreateHmacKeySample createHmacKeySample = new CreateHmacKeySample();
        GetHmacKeySample    getHmacKeySample    = new GetHmacKeySample();

        string serviceAccountEmail = _fixture.GetServiceAccountEmail();

        // Create key.
        var key = createHmacKeySample.CreateHmacKey(_fixture.ProjectId, serviceAccountEmail);

        _accessId = key.Metadata.AccessId;

        // Get key.
        var keyMetadata = _fixture.HmacChangesPropagated.Eventually(() => getHmacKeySample.GetHmacKey(_fixture.ProjectId, _accessId));

        Assert.Equal(keyMetadata.ServiceAccountEmail, serviceAccountEmail);
    }
    public void TestListHmacKeys()
    {
        CreateHmacKeySample createHmacKeySample = new CreateHmacKeySample();
        ListHmacKeysSample  listHmacKeysSample  = new ListHmacKeysSample();

        string serviceAccountEmail = _bucketFixture.GetServiceAccountEmail();

        // Create key.
        var key = createHmacKeySample.CreateHmacKey(_bucketFixture.ProjectId, serviceAccountEmail);

        _accessId = key.Metadata.AccessId;

        // List keys.
        var keys = listHmacKeysSample.ListHmacKeys(_bucketFixture.ProjectId);

        Assert.Contains(keys, key => key.AccessId == key.AccessId);
    }
Пример #5
0
    public void TestGetHmacKey()
    {
        CreateHmacKeySample createHmacKeySample = new CreateHmacKeySample();
        GetHmacKeySample    getHmacKeySample    = new GetHmacKeySample();

        string serviceAccountEmail = _bucketFixture.GetServiceAccountEmail();

        // Create key.
        var key = createHmacKeySample.CreateHmacKey(_bucketFixture.ProjectId, serviceAccountEmail);

        // Get key.
        var keyMetadata = getHmacKeySample.GetHmacKey(_bucketFixture.ProjectId, key.Metadata.AccessId);

        Assert.Equal(keyMetadata.ServiceAccountEmail, serviceAccountEmail);

        // Delete key.
        _bucketFixture.DeleteHmacKey(key.Metadata.AccessId);
    }
Пример #6
0
    public void TestDeactivateHmacKey()
    {
        CreateHmacKeySample     createHmacKeySample     = new CreateHmacKeySample();
        DeactivateHmacKeySample deactivateHmacKeySample = new DeactivateHmacKeySample();

        string serviceAccountEmail = _bucketFixture.GetServiceAccountEmail();

        // Create key.
        var key = createHmacKeySample.CreateHmacKey(_bucketFixture.ProjectId, serviceAccountEmail);

        _accessId = key.Metadata.AccessId;

        // Deactivate key.
        var keyMetadata = deactivateHmacKeySample.DeactivateHmacKey(_bucketFixture.ProjectId, _accessId);

        Assert.Equal("INACTIVE", keyMetadata.State);
        _isActive = false;
    }
Пример #7
0
    public void TestListHmacKeys()
    {
        CreateHmacKeySample createHmacKeySample = new CreateHmacKeySample();
        ListHmacKeysSample  listHmacKeysSample  = new ListHmacKeysSample();

        string serviceAccountEmail = _fixture.GetServiceAccountEmail();

        // Create key.
        var key = createHmacKeySample.CreateHmacKey(_fixture.ProjectId, serviceAccountEmail);

        _accessId = key.Metadata.AccessId;

        // List keys.
        _fixture.HmacChangesPropagated.Eventually(() =>
        {
            var keys = listHmacKeysSample.ListHmacKeys(_fixture.ProjectId);
            Assert.Contains(keys, key => key.AccessId == key.AccessId);
        });
    }
    public void TestActivateHmacKey()
    {
        CreateHmacKeySample     createHmacKeySample     = new CreateHmacKeySample();
        DeactivateHmacKeySample deactivateHmacKeySample = new DeactivateHmacKeySample();
        ActivateHmacKeySample   activateHmacKeySample   = new ActivateHmacKeySample();

        string serviceAccountEmail = _bucketFixture.GetServiceAccountEmail();

        // Create key.
        var key = createHmacKeySample.CreateHmacKey(_bucketFixture.ProjectId, serviceAccountEmail);

        // Deactivate key.
        deactivateHmacKeySample.DeactivateHmacKey(_bucketFixture.ProjectId, key.Metadata.AccessId);

        // Activate key.
        var keyMetadata = activateHmacKeySample.ActivateHmacKey(_bucketFixture.ProjectId, key.Metadata.AccessId);

        Assert.Equal("ACTIVE", keyMetadata.State);

        // Delete key.
        _bucketFixture.DeleteHmacKey(key.Metadata.AccessId);
    }
Пример #9
0
    public void TestActivateHmacKey()
    {
        CreateHmacKeySample     createHmacKeySample     = new CreateHmacKeySample();
        DeactivateHmacKeySample deactivateHmacKeySample = new DeactivateHmacKeySample();
        ActivateHmacKeySample   activateHmacKeySample   = new ActivateHmacKeySample();

        string serviceAccountEmail = _fixture.GetServiceAccountEmail();

        // Create key.
        var key = createHmacKeySample.CreateHmacKey(_fixture.ProjectId, serviceAccountEmail);

        _accessId = key.Metadata.AccessId;

        // Deactivate key.
        _fixture.HmacChangesPropagated.Eventually(() => deactivateHmacKeySample.DeactivateHmacKey(_fixture.ProjectId, _accessId));
        _isActive = false;

        // Activate key.
        var keyMetadata = _fixture.HmacChangesPropagated.Eventually(() => activateHmacKeySample.ActivateHmacKey(_fixture.ProjectId, _accessId));

        Assert.Equal("ACTIVE", keyMetadata.State);
        _isActive = true;
    }