github.com/cs3org/reva/v2@v2.27.7/pkg/storage/utils/decomposedfs/options/options_test.go (about)

     1  // Copyright 2018-2021 CERN
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  //
    15  // In applying this license, CERN does not waive the privileges and immunities
    16  // granted to it by virtue of its status as an Intergovernmental Organization
    17  // or submit itself to any jurisdiction.
    18  
    19  package options_test
    20  
    21  import (
    22  	"github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/options"
    23  
    24  	. "github.com/onsi/ginkgo/v2"
    25  	. "github.com/onsi/gomega"
    26  )
    27  
    28  var _ = Describe("Options", func() {
    29  	var (
    30  		o      *options.Options
    31  		config map[string]interface{}
    32  	)
    33  
    34  	BeforeEach(func() {
    35  		config = map[string]interface{}{}
    36  	})
    37  
    38  	Describe("New", func() {
    39  		JustBeforeEach(func() {
    40  			var err error
    41  			o, err = options.New(config)
    42  			Expect(err).ToNot(HaveOccurred())
    43  		})
    44  
    45  		It("sets defaults", func() {
    46  			Expect(o.MetadataBackend).ToNot(BeEmpty())
    47  		})
    48  
    49  		Context("with unclean root path configuration", func() {
    50  			BeforeEach(func() {
    51  				config["root"] = "foo/"
    52  			})
    53  
    54  			It("sanitizes the root path", func() {
    55  				Expect(o.Root).To(Equal("foo"))
    56  			})
    57  		})
    58  	})
    59  })