12483: Merge branch 'master' into 12483-writable-fs
[arvados.git] / services / keep-web / cadaver_test.go
index 52d30b04cc5824a71df411758a3463d10ea3c299..d4a89c844b567a4d2fb8d3a94f8138e365a672d7 100644 (file)
@@ -12,6 +12,7 @@ import (
        "os"
        "os/exec"
        "strings"
+       "time"
 
        "git.curoverse.com/arvados.git/sdk/go/arvados"
        "git.curoverse.com/arvados.git/sdk/go/arvadostest"
@@ -41,6 +42,10 @@ func (s *IntegrationSuite) TestWebdavWithCadaver(c *check.C) {
        c.Assert(err, check.IsNil)
        writePath := "/c=" + newCollection.UUID + "/t=" + arv.AuthToken + "/"
 
+       pdhPath := "/c=" + strings.Replace(arvadostest.FooAndBarFilesInDirPDH, "+", "-", -1) + "/t=" + arv.AuthToken + "/"
+
+       matchToday := time.Now().Format("Jan +2")
+
        readPath := "/c=" + arvadostest.FooAndBarFilesInDirUUID + "/t=" + arvadostest.ActiveToken + "/"
        type testcase struct {
                path  string
@@ -67,7 +72,7 @@ func (s *IntegrationSuite) TestWebdavWithCadaver(c *check.C) {
                {
                        path:  readPath + "dir1/",
                        cmd:   "ls\n",
-                       match: `(?ms).*bar *3.*foo *3 .*`,
+                       match: `(?ms).*bar *3.*foo +3 +Feb +\d+ +2014.*`,
                },
                {
                        path:  writePath,
@@ -109,7 +114,7 @@ func (s *IntegrationSuite) TestWebdavWithCadaver(c *check.C) {
                {
                        path:  writePath,
                        cmd:   "ls\n",
-                       match: `(?ms).*newdir0.* 0 .*`,
+                       match: `(?ms).*newdir0.* 0 +` + matchToday + ` \d+:\d+\n.*`,
                },
                {
                        path:  writePath,
@@ -141,6 +146,17 @@ func (s *IntegrationSuite) TestWebdavWithCadaver(c *check.C) {
                        cmd:   "put '" + localfile.Name() + "' newdir2/testfile2\n",
                        match: `(?ms).*Uploading .* succeeded.*`,
                },
+               {
+                       path:  writePath,
+                       cmd:   "copy newdir2/testfile2 testfile3\n",
+                       match: `(?ms).*succeeded.*`,
+               },
+               {
+                       path:  writePath,
+                       cmd:   "get testfile3 '" + checkfile.Name() + "'\n",
+                       match: `(?ms).*succeeded.*`,
+                       data:  testdata,
+               },
                {
                        path:  writePath,
                        cmd:   "get newdir2/testfile2 '" + checkfile.Name() + "'\n",
@@ -163,10 +179,25 @@ func (s *IntegrationSuite) TestWebdavWithCadaver(c *check.C) {
                        match: `(?ms).*Uploading .* failed:.*403 Forbidden.*`,
                },
                {
-                       path:  "/c=" + strings.Replace(arvadostest.FooAndBarFilesInDirPDH, "+", "-", -1) + "/t=" + arv.AuthToken + "/",
+                       path:  pdhPath,
                        cmd:   "put '" + localfile.Name() + "' foo\n",
                        match: `(?ms).*Uploading .* failed:.*405 Method Not Allowed.*`,
                },
+               {
+                       path:  pdhPath,
+                       cmd:   "move foo bar\n",
+                       match: `(?ms).*Moving .* failed:.*405 Method Not Allowed.*`,
+               },
+               {
+                       path:  pdhPath,
+                       cmd:   "copy foo bar\n",
+                       match: `(?ms).*Copying .* failed:.*405 Method Not Allowed.*`,
+               },
+               {
+                       path:  pdhPath,
+                       cmd:   "delete foo\n",
+                       match: `(?ms).*Deleting .* failed:.*405 Method Not Allowed.*`,
+               },
        } {
                c.Logf("%s %+v", "http://"+s.testServer.Addr, trial)