Merge branch '13111-no-anonymous-sitefs'
[arvados.git] / services / keep-web / cadaver_test.go
index 22ddd84df09e1883fa0aa1d83d540211c0efc39d..3814a459d53c46c8b92d7dc40d8fd8cd13ee6ae4 100644 (file)
@@ -53,6 +53,8 @@ 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-")
@@ -265,6 +267,22 @@ func (s *IntegrationSuite) testCadaver(c *check.C, password string, pathFunc fun
        }
 }
 
+func (s *IntegrationSuite) TestCadaverByID(c *check.C) {
+       for _, path := range []string{"/by_id", "/by_id/"} {
+               stdout := s.runCadaver(c, arvadostest.ActiveToken, path, "ls")
+               c.Check(stdout, check.Matches, `(?ms).*collection is empty.*`)
+       }
+       for _, path := range []string{
+               "/by_id/" + arvadostest.FooPdh,
+               "/by_id/" + arvadostest.FooPdh + "/",
+               "/by_id/" + arvadostest.FooCollection,
+               "/by_id/" + arvadostest.FooCollection + "/",
+       } {
+               stdout := s.runCadaver(c, arvadostest.ActiveToken, path, "ls")
+               c.Check(stdout, check.Matches, `(?ms).*\s+foo\s+3 .*`)
+       }
+}
+
 func (s *IntegrationSuite) TestCadaverUsersDir(c *check.C) {
        for _, path := range []string{"/"} {
                stdout := s.runCadaver(c, arvadostest.ActiveToken, path, "ls")