[arvados] updated: 2.5.0-198-g20b5d769b

git repository hosting git at public.arvados.org
Thu Feb 23 16:27:10 UTC 2023


Summary of changes:
 services/keep-web/handler_test.go | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

       via  20b5d769bc6c835653fda9e97a08b6c1a70cb879 (commit)
      from  985e3c8b29f684dace905bf787d4b870a4cdfe63 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 20b5d769bc6c835653fda9e97a08b6c1a70cb879
Author: Tom Clegg <tom at curii.com>
Date:   Thu Feb 23 11:26:36 2023 -0500

    19963: Test workbench2 login flow starting with no token.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/services/keep-web/handler_test.go b/services/keep-web/handler_test.go
index fac75214d..3b41d80cf 100644
--- a/services/keep-web/handler_test.go
+++ b/services/keep-web/handler_test.go
@@ -551,6 +551,41 @@ func (s *IntegrationSuite) TestVhostRedirectWithNoCache(c *check.C) {
 	c.Check(u.Query().Get("redirectToDownload"), check.Equals, "")
 }
 
+func (s *IntegrationSuite) TestNoTokenWorkbench2LoginFlow(c *check.C) {
+	for _, trial := range []struct {
+		anonToken    bool
+		cacheControl string
+	}{
+		{},
+		{cacheControl: "no-cache"},
+		{anonToken: true},
+		{anonToken: true, cacheControl: "no-cache"},
+	} {
+		c.Logf("trial: %+v", trial)
+
+		if trial.anonToken {
+			s.handler.Cluster.Users.AnonymousUserToken = arvadostest.AnonymousToken
+		} else {
+			s.handler.Cluster.Users.AnonymousUserToken = ""
+		}
+		req, err := http.NewRequest("GET", "http://"+arvadostest.FooCollection+".example.com/foo", nil)
+		c.Assert(err, check.IsNil)
+		req.Header.Set("Sec-Fetch-Mode", "navigate")
+		if trial.cacheControl != "" {
+			req.Header.Set("Cache-Control", trial.cacheControl)
+		}
+		resp := httptest.NewRecorder()
+		s.handler.ServeHTTP(resp, req)
+		c.Check(resp.Code, check.Equals, http.StatusSeeOther)
+		u, err := url.Parse(resp.Header().Get("Location"))
+		c.Assert(err, check.IsNil)
+		c.Logf("redirected to %q", u)
+		c.Check(u.Host, check.Equals, s.handler.Cluster.Services.Workbench2.ExternalURL.Host)
+		c.Check(u.Query().Get("redirectToPreview"), check.Equals, "/c="+arvadostest.FooCollection+"/foo")
+		c.Check(u.Query().Get("redirectToDownload"), check.Equals, "")
+	}
+}
+
 func (s *IntegrationSuite) TestVhostRedirectQueryTokenSingleOriginError(c *check.C) {
 	s.testVhostRedirectTokenToCookie(c, "GET",
 		"example.com/c="+arvadostest.FooCollection+"/foo",

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list