1
// Copyright 2015 Canonical Ltd.
2
// Copyright 2015 Cloudbase Solutions SRL
3
// Licensed under the LGPLv3, see LICENCE file for details.
8
"github.com/juju/utils/packaging/commands"
9
"github.com/juju/utils/proxy"
10
gc "gopkg.in/check.v1"
13
var _ = gc.Suite(&YumSuite{})
15
type YumSuite struct {
16
paccmder commands.PackageCommander
19
func (s *YumSuite) SetUpSuite(c *gc.C) {
20
s.paccmder = commands.NewYumPackageCommander()
23
func (s *YumSuite) TestProxyConfigContentsEmpty(c *gc.C) {
24
out := s.paccmder.ProxyConfigContents(proxy.Settings{})
25
c.Assert(out, gc.Equals, "")
28
func (s *YumSuite) TestProxyConfigContentsPartial(c *gc.C) {
29
sets := proxy.Settings{
30
Http: "dat-proxy.zone:8080",
33
output := s.paccmder.ProxyConfigContents(sets)
34
c.Assert(output, gc.Equals, "http_proxy=dat-proxy.zone:8080")
37
func (s *YumSuite) TestProxyConfigContentsFull(c *gc.C) {
38
sets := proxy.Settings{
39
Http: "dat-proxy.zone:8080",
40
Https: "https://much-security.com",
41
Ftp: "gimme-files.zone",
43
expected := `http_proxy=dat-proxy.zone:8080
44
https_proxy=https://much-security.com
45
ftp_proxy=gimme-files.zone`
47
output := s.paccmder.ProxyConfigContents(sets)
48
c.Assert(output, gc.Equals, expected)