@@ -13,7 +13,7 @@ import (
1313func TestResourceNotebookRead (t * testing.T ) {
1414 path := "/test/path.py"
1515 objectID := 12345
16- d , err := qa.ResourceFixture {
16+ qa.ResourceFixture {
1717 Fixtures : []qa.HTTPFixture {
1818 {
1919 Method : http .MethodGet ,
@@ -30,17 +30,18 @@ func TestResourceNotebookRead(t *testing.T) {
3030 Read : true ,
3131 New : true ,
3232 ID : path ,
33- }.Apply (t )
34- assert .NoError (t , err )
35- assert .Equal (t , path , d .Id ())
36- assert .Equal (t , path , d .Get ("path" ))
37- assert .Equal (t , "PYTHON" , d .Get ("language" ))
38- assert .Equal (t , objectID , d .Get ("object_id" ))
33+ }.ApplyAndExpectData (t , map [string ]any {
34+ "path" : path ,
35+ "object_id" : objectID ,
36+ "language" : "PYTHON" ,
37+ "id" : path ,
38+ "workspace_path" : "/Workspace" + path ,
39+ })
3940}
4041
4142func TestResourceNotebookDelete (t * testing.T ) {
4243 path := "/test/path.py"
43- d , err := qa.ResourceFixture {
44+ qa.ResourceFixture {
4445 Fixtures : []qa.HTTPFixture {
4546 {
4647 Method : http .MethodPost ,
@@ -52,9 +53,9 @@ func TestResourceNotebookDelete(t *testing.T) {
5253 Resource : ResourceNotebook (),
5354 Delete : true ,
5455 ID : path ,
55- }.Apply ( t )
56- assert . NoError ( t , err )
57- assert . Equal ( t , path , d . Id () )
56+ }.ApplyAndExpectData ( t , map [ string ] any {
57+ "id" : path ,
58+ } )
5859}
5960
6061func TestResourceNotebookRead_NotFound (t * testing.T ) {
@@ -99,7 +100,7 @@ func TestResourceNotebookRead_Error(t *testing.T) {
99100}
100101
101102func TestResourceNotebookCreate_DirectoryExist (t * testing.T ) {
102- d , err := qa.ResourceFixture {
103+ qa.ResourceFixture {
103104 Fixtures : []qa.HTTPFixture {
104105 {
105106 Method : "POST" ,
@@ -144,13 +145,14 @@ func TestResourceNotebookCreate_DirectoryExist(t *testing.T) {
144145 "path" : "/foo/path.py" ,
145146 },
146147 Create : true ,
147- }.Apply (t )
148- assert .NoError (t , err )
149- assert .Equal (t , "/foo/path.py" , d .Id ())
148+ }.ApplyAndExpectData (t , map [string ]any {
149+ "path" : "/foo/path.py" ,
150+ "id" : "/foo/path.py" ,
151+ })
150152}
151153
152154func TestResourceNotebookCreate_DirectoryDoesntExist (t * testing.T ) {
153- d , err := qa.ResourceFixture {
155+ qa.ResourceFixture {
154156 Fixtures : []qa.HTTPFixture {
155157 {
156158 Method : "POST" ,
@@ -211,9 +213,10 @@ func TestResourceNotebookCreate_DirectoryDoesntExist(t *testing.T) {
211213 "path" : "/foo/path.py" ,
212214 },
213215 Create : true ,
214- }.Apply (t )
215- assert .NoError (t , err )
216- assert .Equal (t , "/foo/path.py" , d .Id ())
216+ }.ApplyAndExpectData (t , map [string ]any {
217+ "path" : "/foo/path.py" ,
218+ "id" : "/foo/path.py" ,
219+ })
217220}
218221
219222func TestResourceNotebookCreate_DirectoryCreateError (t * testing.T ) {
@@ -260,7 +263,7 @@ func TestResourceNotebookCreate_DirectoryCreateError(t *testing.T) {
260263}
261264
262265func TestResourceNotebookCreateSource_Jupyter (t * testing.T ) {
263- d , err := qa.ResourceFixture {
266+ qa.ResourceFixture {
264267 Fixtures : []qa.HTTPFixture {
265268 {
266269 Method : http .MethodPost ,
@@ -308,13 +311,13 @@ func TestResourceNotebookCreateSource_Jupyter(t *testing.T) {
308311 "path" : "/Mars" ,
309312 },
310313 Create : true ,
311- }.Apply ( t )
312- assert . NoError ( t , err )
313- assert . Equal ( t , "/Mars" , d . Id () )
314+ }.ApplyAndExpectData ( t , map [ string ] any {
315+ "id" : "/Mars" ,
316+ } )
314317}
315318
316319func TestResourceNotebookCreateSource (t * testing.T ) {
317- d , err := qa.ResourceFixture {
320+ qa.ResourceFixture {
318321 Fixtures : []qa.HTTPFixture {
319322 {
320323 Method : http .MethodPost ,
@@ -346,9 +349,9 @@ func TestResourceNotebookCreateSource(t *testing.T) {
346349 "path" : "/Dashboard" ,
347350 },
348351 Create : true ,
349- }.Apply ( t )
350- assert . NoError ( t , err )
351- assert . Equal ( t , "/Dashboard" , d . Id () )
352+ }.ApplyAndExpectData ( t , map [ string ] any {
353+ "id" : "/Dashboard" ,
354+ } )
352355}
353356
354357func TestResourceNotebookCreate_Error (t * testing.T ) {
0 commit comments