-
Notifications
You must be signed in to change notification settings - Fork 423
/
Copy pathdata_dbfs_file_paths_test.go
56 lines (53 loc) · 1.06 KB
/
data_dbfs_file_paths_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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package storage
import (
"testing"
"github.com/databricks/terraform-provider-databricks/qa"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestDataSourceFilePaths(t *testing.T) {
d, err := qa.ResourceFixture{
Fixtures: []qa.HTTPFixture{
{
Method: "GET",
Resource: "/api/2.0/dbfs/list?path=%2Fa%2Fb%2Fc",
Response: FileList{
[]FileInfo{
{
Path: "/a/b/c/d",
IsDir: true,
},
},
},
},
{
Method: "GET",
Resource: "/api/2.0/dbfs/list?path=%2Fa%2Fb%2Fc%2Fd",
Response: FileList{
[]FileInfo{
{
Path: "/a/b/c/d/e",
FileSize: 1024,
IsDir: false,
},
{
Path: "/a/b/c/d/f",
FileSize: 1025,
IsDir: false,
},
},
},
},
},
Read: true,
NonWritable: true,
Resource: DataSourceDbfsFilePaths(),
ID: ".",
State: map[string]any{
"path": "/a/b/c",
"recursive": true,
},
}.Apply(t)
require.NoError(t, err)
assert.Equal(t, "/a/b/c", d.Id())
}