22235: removed stray divider that can show up at the end of the toolbar
[arvados.git] / services / keep-web / status_test.go
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 package keepweb
6
7 import (
8         "encoding/json"
9         "net/http"
10         "net/http/httptest"
11         "net/url"
12
13         "git.arvados.org/arvados.git/sdk/go/arvadostest"
14         "gopkg.in/check.v1"
15 )
16
17 func (s *UnitSuite) TestStatus(c *check.C) {
18         u, _ := url.Parse("http://keep-web.example/status.json")
19         req := &http.Request{
20                 Method:     "GET",
21                 Host:       u.Host,
22                 URL:        u,
23                 RequestURI: u.RequestURI(),
24         }
25         resp := httptest.NewRecorder()
26         s.handler.ServeHTTP(resp, req)
27         c.Check(resp.Code, check.Equals, http.StatusOK)
28
29         var status map[string]interface{}
30         err := json.NewDecoder(resp.Body).Decode(&status)
31         c.Check(err, check.IsNil)
32         c.Check(status["Version"], check.Not(check.Equals), "")
33 }
34
35 func (s *IntegrationSuite) TestNoStatusFromVHost(c *check.C) {
36         u, _ := url.Parse("http://" + arvadostest.FooCollection + "--keep-web.example/status.json")
37         req := &http.Request{
38                 Method:     "GET",
39                 Host:       u.Host,
40                 URL:        u,
41                 RequestURI: u.RequestURI(),
42                 Header: http.Header{
43                         "Authorization": {"Bearer " + arvadostest.ActiveToken},
44                 },
45         }
46         resp := httptest.NewRecorder()
47         s.handler.ServeHTTP(resp, req)
48         c.Check(resp.Code, check.Equals, http.StatusNotFound)
49 }