13993: Add TestGetLocalCollection
authorPeter Amstutz <pamstutz@veritasgenetics.com>
Tue, 11 Sep 2018 15:05:34 +0000 (11:05 -0400)
committerPeter Amstutz <pamstutz@veritasgenetics.com>
Tue, 11 Sep 2018 15:05:34 +0000 (11:05 -0400)
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz@veritasgenetics.com>

lib/controller/federation_test.go

index f70a8981f4e56c034dbd1dda05e4644d3612d587..8d32b695da94ec3cdadbd30a827bff24c03234e2 100644 (file)
@@ -10,6 +10,7 @@ import (
        "net/http"
        "net/http/httptest"
        "net/url"
+       "os"
        "strings"
        "time"
 
@@ -301,6 +302,28 @@ func (s *FederationSuite) checkJSONErrorMatches(c *check.C, resp *http.Response,
        c.Check(jresp.Errors[0], check.Matches, re)
 }
 
+func (s *FederationSuite) TestGetLocalCollection(c *check.C) {
+       np := arvados.NodeProfile{
+               Controller: arvados.SystemServiceInstance{Listen: ":"},
+               RailsAPI: arvados.SystemServiceInstance{Listen: os.Getenv("ARVADOS_TEST_API_HOST"),
+                       TLS: true, Insecure: true}}
+       s.testHandler.Cluster.ClusterID = "zzzzz"
+       s.testHandler.Cluster.NodeProfiles["*"] = np
+       s.testHandler.NodeProfile = &np
+
+       req := httptest.NewRequest("GET", "/arvados/v1/collections/"+arvadostest.UserAgreementCollection, nil)
+       req.Header.Set("Authorization", "Bearer "+arvadostest.ActiveToken)
+       resp := s.testRequest(req)
+
+       c.Check(resp.StatusCode, check.Equals, http.StatusOK)
+       var col arvados.Collection
+       c.Check(json.NewDecoder(resp.Body).Decode(&col), check.IsNil)
+       c.Check(col.UUID, check.Equals, arvadostest.UserAgreementCollection)
+       c.Check(col.ManifestText, check.Matches,
+               `\. 6a4ff0499484c6c79c95cd8c566bd25f\+249025\+A[0-9a-f]{40}@[0-9a-f]{8} 0:249025:GNU_General_Public_License,_version_3.pdf
+`)
+}
+
 func (s *FederationSuite) TestGetRemoteCollection(c *check.C) {
        req := httptest.NewRequest("GET", "/arvados/v1/collections/"+arvadostest.UserAgreementCollection, nil)
        req.Header.Set("Authorization", "Bearer "+arvadostest.ActiveToken)