Jack Neus | 08ccd45 | 2019-08-13 09:35:41 -0600 | [diff] [blame] | 1 | // Copyright 2019 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
Sean Abraham | 47cc585 | 2020-06-30 09:32:41 -0600 | [diff] [blame] | 4 | |
Sean Abraham | c2c5a6a | 2020-06-23 17:54:41 -0600 | [diff] [blame] | 5 | package branch |
Jack Neus | 08ccd45 | 2019-08-13 09:35:41 -0600 | [diff] [blame] | 6 | |
| 7 | import ( |
| 8 | "testing" |
| 9 | |
| 10 | "go.chromium.org/chromiumos/infra/go/internal/repo" |
| 11 | "gotest.tools/assert" |
| 12 | ) |
| 13 | |
| 14 | func TestProjectFetchUrl(t *testing.T) { |
Sean Abraham | c2c5a6a | 2020-06-23 17:54:41 -0600 | [diff] [blame] | 15 | WorkingManifest = repo.Manifest{ |
Jack Neus | 08ccd45 | 2019-08-13 09:35:41 -0600 | [diff] [blame] | 16 | Remotes: []repo.Remote{ |
| 17 | {Name: "remote", Fetch: "file:///tmp/path/to/remote"}, |
| 18 | }, |
| 19 | Projects: []repo.Project{ |
| 20 | {Path: "foo/bar/project", Name: "foo/bar/project", RemoteName: "remote"}, |
| 21 | }, |
| 22 | } |
Sean Abraham | c2c5a6a | 2020-06-23 17:54:41 -0600 | [diff] [blame] | 23 | url, err := ProjectFetchUrl("foo/bar/project") |
Jack Neus | 08ccd45 | 2019-08-13 09:35:41 -0600 | [diff] [blame] | 24 | assert.NilError(t, err) |
| 25 | assert.Equal(t, url, "file:///tmp/path/to/remote/foo/bar/project") |
| 26 | } |