@@ -31,56 +31,8 @@ func TestProjectImport(t *testing.T) {
3131 files , ok := req ["files" ].(map [string ]any )
3232 require .True (t , ok )
3333 require .Equal (t , "bar" , files ["foo" ])
34- excludes , ok := req ["excludes" ].([]any )
35- require .True (t , ok )
36- require .Len (t , excludes , 2 )
37- require .Equal (t , "connectors" , excludes [0 ])
38- require .Equal (t , "flows" , excludes [1 ])
39- }))
40- req := & descope.ImportSnapshotRequest {
41- Files : map [string ]any {"foo" : "bar" },
42- Excludes : []string {"connectors" , "flows" },
43- }
44- err := mgmt .Project ().ImportSnapshot (context .Background (), req )
45- require .NoError (t , err )
46- }
47-
48- func TestProjectImportWithoutExcludes (t * testing.T ) {
49- mgmt := newTestMgmt (nil , helpers .DoOk (func (r * http.Request ) {
50- require .Equal (t , r .Header .Get ("Authorization" ), "Bearer a:key" )
51- req := map [string ]any {}
52- require .NoError (t , helpers .ReadBody (r , & req ))
53- files , ok := req ["files" ].(map [string ]any )
54- require .True (t , ok )
55- require .Equal (t , "bar" , files ["foo" ])
56- // Verify excludes field is not present in the JSON when nil
57- _ , excludesPresent := req ["excludes" ]
58- require .False (t , excludesPresent , "excludes field should not be present when nil" )
59- }))
60- req := & descope.ImportSnapshotRequest {
61- Files : map [string ]any {"foo" : "bar" },
62- // Excludes is intentionally nil to test backward compatibility
63- }
64- err := mgmt .Project ().ImportSnapshot (context .Background (), req )
65- require .NoError (t , err )
66- }
67-
68- func TestProjectImportWithEmptyExcludes (t * testing.T ) {
69- mgmt := newTestMgmt (nil , helpers .DoOk (func (r * http.Request ) {
70- require .Equal (t , r .Header .Get ("Authorization" ), "Bearer a:key" )
71- req := map [string ]any {}
72- require .NoError (t , helpers .ReadBody (r , & req ))
73- files , ok := req ["files" ].(map [string ]any )
74- require .True (t , ok )
75- require .Equal (t , "bar" , files ["foo" ])
76- // Verify excludes field is not present in the JSON when empty (due to omitempty)
77- _ , excludesPresent := req ["excludes" ]
78- require .False (t , excludesPresent , "excludes field should not be present when empty due to omitempty" )
7934 }))
80- req := & descope.ImportSnapshotRequest {
81- Files : map [string ]any {"foo" : "bar" },
82- Excludes : []string {}, // Empty slice to test backward compatibility
83- }
35+ req := & descope.ImportSnapshotRequest {Files : map [string ]any {"foo" : "bar" }}
8436 err := mgmt .Project ().ImportSnapshot (context .Background (), req )
8537 require .NoError (t , err )
8638}
@@ -100,7 +52,6 @@ func TestValidateProjectImport(t *testing.T) {
10052 files , ok := req ["files" ].(map [string ]any )
10153 require .True (t , ok )
10254 require .Equal (t , "bar" , files ["foo" ])
103-
10455 secrets , ok := req ["inputSecrets" ].(map [string ]any )
10556 require .True (t , ok )
10657 list , ok := secrets ["connectors" ].([]any )
0 commit comments