forked from microsoft/hdfs-mount
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FileSystem_test.go
27 lines (24 loc) · 1 KB
/
FileSystem_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
package main
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestIsPathAllowedForStarPrefix(t *testing.T) {
fs, _ := NewFileSystem(nil, "/tmp", []string{"*"}, false, NewDefaultRetryPolicy(WallClock{}), WallClock{})
assert.True(t, fs.IsPathAllowed("/"))
assert.True(t, fs.IsPathAllowed("/foo"))
assert.True(t, fs.IsPathAllowed("/foo/bar"))
}
func TestIsPathAllowedForMiscPrefixes(t *testing.T) {
fs, _ := NewFileSystem(nil, "/tmp", []string{"foo", "bar", "baz/qux"}, false, NewDefaultRetryPolicy(WallClock{}), WallClock{})
assert.True(t, fs.IsPathAllowed("/"))
assert.True(t, fs.IsPathAllowed("/foo"))
assert.True(t, fs.IsPathAllowed("/bar"))
assert.True(t, fs.IsPathAllowed("/foo/x"))
assert.True(t, fs.IsPathAllowed("/baz/qux"))
assert.True(t, fs.IsPathAllowed("/baz/qux/y"))
assert.False(t, fs.IsPathAllowed("qux"))
assert.False(t, fs.IsPathAllowed("w/z"))
}