added new tests with recordings
This commit is contained in:
Родитель
eb013b6761
Коммит
ff52c44237
|
@ -2,5 +2,5 @@
|
|||
"AssetsRepo": "Azure/azure-sdk-assets",
|
||||
"AssetsRepoPrefixPath": "go",
|
||||
"TagPrefix": "go/storage/azfile",
|
||||
"Tag": "go/storage/azfile_d78a137605"
|
||||
"Tag": "go/storage/azfile_6ddd63221c"
|
||||
}
|
||||
|
|
|
@ -421,6 +421,43 @@ func (d *DirectoryRecordedTestsSuite) TestDirSetPropertiesNonDefault() {
|
|||
_require.EqualValues(fileAttributes2, fileAttributes)
|
||||
}
|
||||
|
||||
func (d *DirectoryRecordedTestsSuite) TestDirSetPropertiesFilePermissionFormat() {
|
||||
_require := require.New(d.T())
|
||||
testName := d.T().Name()
|
||||
svcClient, err := testcommon.GetServiceClient(d.T(), testcommon.TestAccountDefault, nil)
|
||||
_require.NoError(err)
|
||||
|
||||
shareName := testcommon.GenerateShareName(testName)
|
||||
shareClient := testcommon.CreateNewShare(context.Background(), _require, shareName, svcClient)
|
||||
defer testcommon.DeleteShare(context.Background(), _require, shareClient)
|
||||
|
||||
dirName := testcommon.GenerateDirectoryName(testName)
|
||||
dirClient := testcommon.GetDirectoryClient(dirName, shareClient)
|
||||
|
||||
cResp, err := dirClient.Create(context.Background(), &directory.CreateOptions{
|
||||
FilePermissionFormat: (*file.PermissionFormat)(to.Ptr(testcommon.FilePermissionBinary)),
|
||||
FilePermissions: &file.Permissions{
|
||||
Permission: &testcommon.SampleBinary,
|
||||
},
|
||||
})
|
||||
_require.NoError(err)
|
||||
_require.NotNil(cResp.FilePermissionKey)
|
||||
_require.NoError(err)
|
||||
|
||||
// Set the custom permissions
|
||||
sResp, err := dirClient.SetProperties(context.Background(), &directory.SetPropertiesOptions{
|
||||
FilePermissionFormat: (*directory.FilePermissionFormat)(to.Ptr(testcommon.FilePermissionFormatSddl)),
|
||||
FilePermissions: &file.Permissions{
|
||||
Permission: &testcommon.SampleSDDL,
|
||||
},
|
||||
})
|
||||
_require.NoError(err)
|
||||
_require.NotNil(sResp.FileCreationTime)
|
||||
_require.NotNil(sResp.FileLastWriteTime)
|
||||
_require.NotNil(sResp.FilePermissionKey)
|
||||
_require.NotEqual(*sResp.FilePermissionKey, *cResp.FilePermissionKey)
|
||||
}
|
||||
|
||||
func (d *DirectoryUnrecordedTestsSuite) TestDirCreateDeleteNonDefault() {
|
||||
_require := require.New(d.T())
|
||||
testName := d.T().Name()
|
||||
|
|
|
@ -8,6 +8,9 @@ package directory
|
|||
|
||||
import "github.com/Azure/azure-sdk-for-go/sdk/storage/azfile/internal/generated"
|
||||
|
||||
// FilePermissionFormat contains the format of the file permissions, Can be sddl (Default) or Binary.
|
||||
type FilePermissionFormat = generated.FilePermissionFormat
|
||||
|
||||
// ListFilesIncludeType defines values for ListFilesIncludeType
|
||||
type ListFilesIncludeType = generated.ListFilesIncludeType
|
||||
|
||||
|
|
|
@ -29,9 +29,6 @@ type DestinationLeaseAccessConditions = generated.DestinationLeaseAccessConditio
|
|||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// PermissionFormat contains the format of the file permissions, Can be sddl (Default) or Binary.
|
||||
type PermissionFormat = generated.FilePermissionFormat
|
||||
|
||||
// CreateOptions contains the optional parameters for the Client.Create method.
|
||||
type CreateOptions struct {
|
||||
// The default value is 'Directory' for Attributes and 'now' for CreationTime and LastWriteTime fields in file.SMBProperties.
|
||||
|
@ -45,7 +42,7 @@ type CreateOptions struct {
|
|||
// explicitly set to SDDL, the permission is returned in SDDL format. If x-ms-file-permission-format is explicitly set to
|
||||
// binary, the permission is returned as a base64 string representing the binary
|
||||
// encoding of the permission
|
||||
FilePermissionFormat *PermissionFormat
|
||||
FilePermissionFormat *FilePermissionFormat
|
||||
}
|
||||
|
||||
func (o *CreateOptions) format() *generated.DirectoryClientCreateOptions {
|
||||
|
@ -55,7 +52,7 @@ func (o *CreateOptions) format() *generated.DirectoryClientCreateOptions {
|
|||
FileCreationTime: to.Ptr(shared.DefaultCurrentTimeString),
|
||||
FileLastWriteTime: to.Ptr(shared.DefaultCurrentTimeString),
|
||||
FilePermission: to.Ptr(shared.DefaultFilePermissionString),
|
||||
FilePermissionFormat: to.Ptr(PermissionFormat(shared.DefaultFilePermissionFormat)),
|
||||
FilePermissionFormat: to.Ptr(FilePermissionFormat(shared.DefaultFilePermissionFormat)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,7 +67,7 @@ func (o *CreateOptions) format() *generated.DirectoryClientCreateOptions {
|
|||
FileLastWriteTime: fileLastWriteTime,
|
||||
FilePermission: permission,
|
||||
FilePermissionKey: permissionKey,
|
||||
FilePermissionFormat: to.Ptr(PermissionFormat(shared.DefaultFilePermissionFormat)),
|
||||
FilePermissionFormat: to.Ptr(FilePermissionFormat(shared.DefaultFilePermissionFormat)),
|
||||
Metadata: o.Metadata,
|
||||
}
|
||||
|
||||
|
@ -101,7 +98,7 @@ type RenameOptions struct {
|
|||
// FilePermissions contains the optional parameters for the permissions on the file.
|
||||
FilePermissions *file.Permissions
|
||||
// FilePermissionFormat contains the file permission format, sddl(Default) or Binary.
|
||||
FilePermissionFormat *PermissionFormat
|
||||
FilePermissionFormat *FilePermissionFormat
|
||||
// IgnoreReadOnly specifies whether the ReadOnly attribute on a pre-existing destination file should be respected.
|
||||
// If true, rename will succeed, otherwise, a previous file at the destination with the ReadOnly attribute set will cause rename to fail.
|
||||
IgnoreReadOnly *bool
|
||||
|
@ -119,7 +116,7 @@ type RenameOptions struct {
|
|||
func (o *RenameOptions) format() (*generated.DirectoryClientRenameOptions, *generated.DestinationLeaseAccessConditions, *generated.CopyFileSMBInfo) {
|
||||
if o == nil {
|
||||
return &generated.DirectoryClientRenameOptions{
|
||||
FilePermissionFormat: to.Ptr(PermissionFormat(shared.DefaultFilePermissionFormat)),
|
||||
FilePermissionFormat: to.Ptr(FilePermissionFormat(shared.DefaultFilePermissionFormat)),
|
||||
}, nil, nil
|
||||
}
|
||||
|
||||
|
@ -130,7 +127,7 @@ func (o *RenameOptions) format() (*generated.DirectoryClientRenameOptions, *gene
|
|||
renameOpts := &generated.DirectoryClientRenameOptions{
|
||||
FilePermission: permission,
|
||||
FilePermissionKey: permissionKey,
|
||||
FilePermissionFormat: to.Ptr(PermissionFormat(shared.DefaultFilePermissionFormat)),
|
||||
FilePermissionFormat: to.Ptr(FilePermissionFormat(shared.DefaultFilePermissionFormat)),
|
||||
IgnoreReadOnly: o.IgnoreReadOnly,
|
||||
Metadata: o.Metadata,
|
||||
ReplaceIfExists: o.ReplaceIfExists,
|
||||
|
@ -177,7 +174,7 @@ type SetPropertiesOptions struct {
|
|||
// The default value is 'preserve' for Permission field in file.Permissions.
|
||||
FilePermissions *file.Permissions
|
||||
// FilePermissionFormat contains the format of the file permissions, Can be sddl (Default) or Binary.
|
||||
FilePermissionFormat *PermissionFormat
|
||||
FilePermissionFormat *FilePermissionFormat
|
||||
}
|
||||
|
||||
func (o *SetPropertiesOptions) format() *generated.DirectoryClientSetPropertiesOptions {
|
||||
|
@ -187,7 +184,7 @@ func (o *SetPropertiesOptions) format() *generated.DirectoryClientSetPropertiesO
|
|||
FileCreationTime: to.Ptr(shared.DefaultPreserveString),
|
||||
FileLastWriteTime: to.Ptr(shared.DefaultPreserveString),
|
||||
FilePermission: to.Ptr(shared.DefaultPreserveString),
|
||||
FilePermissionFormat: to.Ptr(PermissionFormat(shared.DefaultFilePermissionFormat)),
|
||||
FilePermissionFormat: to.Ptr(FilePermissionFormat(shared.DefaultFilePermissionFormat)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,7 +199,7 @@ func (o *SetPropertiesOptions) format() *generated.DirectoryClientSetPropertiesO
|
|||
FileLastWriteTime: fileLastWriteTime,
|
||||
FilePermission: permission,
|
||||
FilePermissionKey: permissionKey,
|
||||
FilePermissionFormat: to.Ptr(PermissionFormat(shared.DefaultFilePermissionFormat)),
|
||||
FilePermissionFormat: to.Ptr(FilePermissionFormat(shared.DefaultFilePermissionFormat)),
|
||||
}
|
||||
|
||||
if o.FilePermissionFormat != nil {
|
||||
|
|
|
@ -67,6 +67,9 @@ const (
|
|||
RangeWriteTypeClear RangeWriteType = generated.FileRangeWriteTypeClear
|
||||
)
|
||||
|
||||
// PermissionFormat contains the format of the file permissions, Can be sddl (Default) or Binary.
|
||||
type PermissionFormat = generated.FilePermissionFormat
|
||||
|
||||
// PossibleRangeWriteTypeValues returns the possible values for the RangeWriteType const type.
|
||||
func PossibleRangeWriteTypeValues() []RangeWriteType {
|
||||
return generated.PossibleFileRangeWriteTypeValues()
|
||||
|
|
|
@ -43,9 +43,6 @@ func ParseNTFSFileAttributes(attributes *string) (*NTFSFileAttributes, error) {
|
|||
// Permissions contains the optional parameters for the permissions on the file.
|
||||
type Permissions = exported.Permissions
|
||||
|
||||
// PermissionFormat contains the format of the file permissions, Can be sddl (Default) or Binary.
|
||||
type PermissionFormat = generated.FilePermissionFormat
|
||||
|
||||
// HTTPHeaders contains optional parameters for the Client.Create method.
|
||||
type HTTPHeaders = generated.ShareFileHTTPHeaders
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@ const (
|
|||
AccessTierTransactionOptimized AccessTier = generated.ShareAccessTierTransactionOptimized
|
||||
)
|
||||
|
||||
type PermissionFormat = generated.FilePermissionFormat
|
||||
|
||||
// PossibleAccessTierValues returns the possible values for the AccessTier const type.
|
||||
func PossibleAccessTierValues() []AccessTier {
|
||||
return generated.PossibleShareAccessTierValues()
|
||||
|
|
|
@ -274,8 +274,6 @@ func (o *CreatePermissionOptions) format(sharePermission string) (Permission, *g
|
|||
// Permission - A permission (a security descriptor) at the share level.
|
||||
type Permission = generated.SharePermission
|
||||
|
||||
type PermissionFormat = generated.FilePermissionFormat
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// GetPermissionOptions contains the optional parameters for the Client.GetPermission method.
|
||||
|
|
Загрузка…
Ссылка в новой задаче