X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/6c78b28f9f54664babc57a4b4372c502065ed5d1..8a27fe370239ecb8e50d53f46b45ed61203a35ca:/services/keep-web/cadaver_test.go diff --git a/services/keep-web/cadaver_test.go b/services/keep-web/cadaver_test.go index 1c93a2b91c..742140f7f3 100644 --- a/services/keep-web/cadaver_test.go +++ b/services/keep-web/cadaver_test.go @@ -2,22 +2,21 @@ // // SPDX-License-Identifier: AGPL-3.0 -package main +package keepweb import ( "bytes" "fmt" "io" "io/ioutil" - "net/url" "os" "os/exec" "path/filepath" "strings" "time" - "git.curoverse.com/arvados.git/sdk/go/arvados" - "git.curoverse.com/arvados.git/sdk/go/arvadostest" + "git.arvados.org/arvados.git/sdk/go/arvados" + "git.arvados.org/arvados.git/sdk/go/arvadostest" check "gopkg.in/check.v1" ) @@ -53,8 +52,6 @@ func (s *IntegrationSuite) TestCadaverUserProject(c *check.C) { } func (s *IntegrationSuite) testCadaver(c *check.C, password string, pathFunc func(arvados.Collection) (string, string, string), skip func(string) bool) { - s.testServer.Config.AnonymousTokens = []string{arvadostest.AnonymousToken} - testdata := []byte("the human tragedy consists in the necessity of living with the consequences of actions performed under the pressure of compulsions we do not understand") tempdir, err := ioutil.TempDir("", "keep-web-test-") @@ -74,7 +71,7 @@ func (s *IntegrationSuite) testCadaver(c *check.C, password string, pathFunc fun var newCollection arvados.Collection arv := arvados.NewClientFromEnv() arv.AuthToken = arvadostest.ActiveToken - err = arv.RequestAndDecode(&newCollection, "POST", "arvados/v1/collections", bytes.NewBufferString(url.Values{"collection": {"{}"}}.Encode()), nil) + err = arv.RequestAndDecode(&newCollection, "POST", "arvados/v1/collections", nil, map[string]interface{}{"collection": map[string]interface{}{}}) c.Assert(err, check.IsNil) readPath, writePath, pdhPath := pathFunc(newCollection) @@ -135,6 +132,16 @@ func (s *IntegrationSuite) testCadaver(c *check.C, password string, pathFunc fun match: `(?ms).*succeeded.*`, data: testdata, }, + { + path: writePath, + cmd: "move testfile \"test &#!%20 file\"\n", + match: `(?ms).*Moving .* succeeded.*`, + }, + { + path: writePath, + cmd: "move \"test &#!%20 file\" testfile\n", + match: `(?ms).*Moving .* succeeded.*`, + }, { path: writePath, cmd: "move testfile newdir0/\n", @@ -269,7 +276,7 @@ func (s *IntegrationSuite) testCadaver(c *check.C, password string, pathFunc fun match: `(?ms).*Locking .* failed:.*405 Method Not Allowed.*`, }, } { - c.Logf("%s %+v", "http://"+s.testServer.Addr, trial) + c.Logf("%s %+v", s.testServer.URL, trial) if skip != nil && skip(trial.path) { c.Log("(skip)") continue @@ -334,14 +341,14 @@ func (s *IntegrationSuite) runCadaver(c *check.C, password, path, stdin string) c.Assert(err, check.IsNil) defer os.RemoveAll(tempdir) - cmd := exec.Command("cadaver", "http://"+s.testServer.Addr+path) + cmd := exec.Command("cadaver", s.testServer.URL+path) if password != "" { // cadaver won't try username/password authentication // unless the server responds 401 to an // unauthenticated request, which it only does in // AttachmentOnlyHost, TrustAllContent, and // per-collection vhost cases. - s.testServer.Config.AttachmentOnlyHost = s.testServer.Addr + s.handler.Cluster.Services.WebDAVDownload.ExternalURL.Host = s.testServer.URL[7:] cmd.Env = append(os.Environ(), "HOME="+tempdir) f, err := os.OpenFile(filepath.Join(tempdir, ".netrc"), os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0600)