X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/c26db1da1d7bb75edf1579a8647023ee88db816a..2c3a6a67bc01241f57e815f4f7e4678bd6eadb03:/lib/controller/federation_test.go diff --git a/lib/controller/federation_test.go b/lib/controller/federation_test.go index 43cce4c276..c935e20be6 100644 --- a/lib/controller/federation_test.go +++ b/lib/controller/federation_test.go @@ -21,7 +21,7 @@ import ( "git.curoverse.com/arvados.git/sdk/go/arvadostest" "git.curoverse.com/arvados.git/sdk/go/httpserver" "git.curoverse.com/arvados.git/sdk/go/keepclient" - "github.com/Sirupsen/logrus" + "github.com/sirupsen/logrus" check "gopkg.in/check.v1" ) @@ -347,6 +347,8 @@ func (s *FederationSuite) TestGetLocalCollection(c *check.C) { s.testHandler.Cluster.NodeProfiles["*"] = np s.testHandler.NodeProfile = &np + // HTTP GET + req := httptest.NewRequest("GET", "/arvados/v1/collections/"+arvadostest.UserAgreementCollection, nil) req.Header.Set("Authorization", "Bearer "+arvadostest.ActiveToken) resp := s.testRequest(req) @@ -358,6 +360,23 @@ func (s *FederationSuite) TestGetLocalCollection(c *check.C) { 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 `) + + // HTTP POST with _method=GET as a form parameter + + req = httptest.NewRequest("POST", "/arvados/v1/collections/"+arvadostest.UserAgreementCollection, bytes.NewBufferString((url.Values{ + "_method": {"GET"}, + }).Encode())) + req.Header.Set("Authorization", "Bearer "+arvadostest.ActiveToken) + req.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8") + resp = s.testRequest(req) + + c.Check(resp.StatusCode, check.Equals, http.StatusOK) + 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) {