@@ -371,10 +371,21 @@ var _ = Describe("ocdav", func() {
371
371
Status : status .NewOK (ctx ),
372
372
}, nil )
373
373
374
+ resourceId := & cs3storageprovider.ResourceId {StorageId : "storage" , SpaceId : "provider" , OpaqueId : "opaque" }
375
+ resourceETag := "some-etag"
376
+ client .On ("Stat" , mock .Anything , mock .Anything ).Return (& cs3storageprovider.StatResponse {
377
+ Status : status .NewOK (ctx ),
378
+ Info : & cs3storageprovider.ResourceInfo {
379
+ Id : resourceId ,
380
+ Etag : resourceETag ,
381
+ },
382
+ }, nil )
383
+
374
384
handler .Handler ().ServeHTTP (rr , req )
375
385
Expect (rr ).To (HaveHTTPStatus (http .StatusCreated ))
376
386
Expect (rr ).To (HaveHTTPBody (BeEmpty ()), "Body must be empty" )
377
- // TODO expect fileid and etag header?
387
+ Expect (rr ).To (HaveHTTPHeaderWithValue (net .HeaderOCFileID , storagespace .FormatResourceID (resourceId )))
388
+ Expect (rr ).To (HaveHTTPHeaderWithValue (net .HeaderOCETag , resourceETag ))
378
389
})
379
390
380
391
})
@@ -1254,6 +1265,15 @@ var _ = Describe("ocdav", func() {
1254
1265
Status : status .NewOK (ctx ),
1255
1266
}, nil )
1256
1267
1268
+ if expectedStatus == http .StatusCreated {
1269
+ client .On ("Stat" , mock .Anything , mock .Anything ).Return (& cs3storageprovider.StatResponse {
1270
+ Status : status .NewOK (ctx ),
1271
+ Info : & cs3storageprovider.ResourceInfo {
1272
+ Id : mReq .Source .ResourceId ,
1273
+ },
1274
+ }, nil )
1275
+ }
1276
+
1257
1277
rr := httptest .NewRecorder ()
1258
1278
req , err := http .NewRequest ("MKCOL" , endpoint + "/foo" , strings .NewReader ("" ))
1259
1279
Expect (err ).ToNot (HaveOccurred ())
@@ -1342,6 +1362,15 @@ var _ = Describe("ocdav", func() {
1342
1362
return utils .ResourceEqual (req .Ref , & ref )
1343
1363
})).Return (nil , fmt .Errorf ("unexpected io error" ))
1344
1364
1365
+ if expectedStatus == http .StatusCreated {
1366
+ client .On ("Stat" , mock .Anything , mock .Anything ).Return (& cs3storageprovider.StatResponse {
1367
+ Status : status .NewOK (ctx ),
1368
+ Info : & cs3storageprovider.ResourceInfo {
1369
+ Id : mReq .Source .ResourceId ,
1370
+ },
1371
+ }, nil )
1372
+ }
1373
+
1345
1374
rr := httptest .NewRecorder ()
1346
1375
req , err := http .NewRequest ("MKCOL" , endpoint + "/foo" , strings .NewReader ("" ))
1347
1376
Expect (err ).ToNot (HaveOccurred ())
@@ -1431,6 +1460,15 @@ var _ = Describe("ocdav", func() {
1431
1460
Status : status .NewOK (ctx ),
1432
1461
}, nil )
1433
1462
1463
+ if expectedStatus == http .StatusCreated {
1464
+ client .On ("Stat" , mock .Anything , mock .Anything ).Return (& cs3storageprovider.StatResponse {
1465
+ Status : status .NewOK (ctx ),
1466
+ Info : & cs3storageprovider.ResourceInfo {
1467
+ Id : mReq .Source .ResourceId ,
1468
+ },
1469
+ }, nil )
1470
+ }
1471
+
1434
1472
rr := httptest .NewRecorder ()
1435
1473
req , err := http .NewRequest ("MKCOL" , endpoint + "/foo" , strings .NewReader ("" ))
1436
1474
Expect (err ).ToNot (HaveOccurred ())
@@ -1519,6 +1557,15 @@ var _ = Describe("ocdav", func() {
1519
1557
Status : status .NewNotFound (ctx , "not found" ),
1520
1558
}, nil )
1521
1559
1560
+ if expectedStatus == http .StatusCreated {
1561
+ client .On ("Stat" , mock .Anything , mock .Anything ).Return (& cs3storageprovider.StatResponse {
1562
+ Status : status .NewOK (ctx ),
1563
+ Info : & cs3storageprovider.ResourceInfo {
1564
+ Id : mReq .Source .ResourceId ,
1565
+ },
1566
+ }, nil )
1567
+ }
1568
+
1522
1569
rr := httptest .NewRecorder ()
1523
1570
req , err := http .NewRequest ("MKCOL" , endpoint + "/foo" , strings .NewReader ("" ))
1524
1571
Expect (err ).ToNot (HaveOccurred ())
@@ -1672,6 +1719,15 @@ var _ = Describe("ocdav", func() {
1672
1719
}, nil )
1673
1720
}
1674
1721
1722
+ if expectedStatus == http .StatusCreated {
1723
+ client .On ("Stat" , mock .Anything , mock .Anything ).Return (& cs3storageprovider.StatResponse {
1724
+ Status : status .NewOK (ctx ),
1725
+ Info : & cs3storageprovider.ResourceInfo {
1726
+ Id : mReq .Source .ResourceId ,
1727
+ },
1728
+ }, nil )
1729
+ }
1730
+
1675
1731
parentRef := cs3storageprovider.Reference {
1676
1732
ResourceId : userspace .Root ,
1677
1733
Path : utils .MakeRelativePath (path .Dir (expectedPath )),
@@ -1808,6 +1864,15 @@ var _ = Describe("ocdav", func() {
1808
1864
Status : status .NewOK (ctx ),
1809
1865
}, nil )
1810
1866
1867
+ if expectedStatus == http .StatusCreated {
1868
+ client .On ("Stat" , mock .Anything , mock .Anything ).Return (& cs3storageprovider.StatResponse {
1869
+ Status : status .NewOK (ctx ),
1870
+ Info : & cs3storageprovider.ResourceInfo {
1871
+ Id : mReq .Source .ResourceId ,
1872
+ },
1873
+ }, nil )
1874
+ }
1875
+
1811
1876
rr := httptest .NewRecorder ()
1812
1877
req , err := http .NewRequest ("MKCOL" , endpoint + "/foo" , strings .NewReader ("" ))
1813
1878
req .Header .Set ("If" , "(<urn:uuid:181d4fae-7d8c-11d0-a765-00a0c91e6bf2>)" )
0 commit comments