| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. |
| 4 |
| 5 package viewer |
| 6 |
| 7 import ( |
| 8 "fmt" |
| 9 "testing" |
| 10 |
| 11 "github.com/luci/luci-go/common/config" |
| 12 "github.com/luci/luci-go/logdog/common/types" |
| 13 |
| 14 . "github.com/smartystreets/goconvey/convey" |
| 15 ) |
| 16 |
| 17 func TestGetURL(t *testing.T) { |
| 18 t.Parallel() |
| 19 |
| 20 Convey(`Testing viewer URL generation`, t, func() { |
| 21 for _, tc := range []struct { |
| 22 host string |
| 23 project config.ProjectName |
| 24 paths []types.StreamPath |
| 25 url string |
| 26 }{ |
| 27 {"example.appspot.com", "test", []types.StreamPath{"foo/
bar/+/baz"}, |
| 28 "https://example.appspot.com/v/?s=test%2Ffoo%2Fb
ar%2F%2B%2Fbaz"}, |
| 29 {"example.appspot.com", "test", []types.StreamPath{"foo/
bar/+/baz", "qux/+/quux"}, |
| 30 "https://example.appspot.com/v/?s=test%2Ffoo%2Fb
ar%2F%2B%2Fbaz&s=test%2Fqux%2F%2B%2Fquux"}, |
| 31 {"example.appspot.com", "test", []types.StreamPath{"quer
y/*/+/**"}, |
| 32 "https://example.appspot.com/v/?s=test%2Fquery%2
F%2A%2F%2B%2F%2A%2A"}, |
| 33 } { |
| 34 Convey(fmt.Sprintf(`Can generate a URL for host %q, proj
ect %q, paths %q: [%s]`, tc.host, tc.project, tc.paths, tc.url), func() { |
| 35 So(GetURL(tc.host, tc.project, tc.paths...), Sho
uldEqual, tc.url) |
| 36 }) |
| 37 } |
| 38 }) |
| 39 } |
| OLD | NEW |