forked from juju/juju
-
Notifications
You must be signed in to change notification settings - Fork 0
/
client_test.go
38 lines (32 loc) · 890 Bytes
/
client_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright 2020 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package charmhub
import (
"github.com/juju/testing"
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
)
type ConfigSuite struct {
testing.IsolationSuite
}
var _ = gc.Suite(&ConfigSuite{})
func (s *ConfigSuite) TestBasePath(c *gc.C) {
config := Config{
URL: "http://api.foo.bar.com",
Version: "v2",
Entity: "meshuggah",
}
path, err := config.BasePath()
c.Assert(err, jc.ErrorIsNil)
c.Assert(path.String(), gc.Equals, "http://api.foo.bar.com/v2/meshuggah")
}
func (s *ConfigSuite) TestBasePathWithTrailingSlash(c *gc.C) {
config := Config{
URL: "http://api.foo.bar.com/",
Version: "v2",
Entity: "meshuggah",
}
path, err := config.BasePath()
c.Assert(err, jc.ErrorIsNil)
c.Assert(path.String(), gc.Equals, "http://api.foo.bar.com/v2/meshuggah")
}