~juju-qa/ubuntu/yakkety/juju/juju-1.25.8

« back to all changes in this revision

Viewing changes to src/github.com/juju/utils/packaging/commands/yum_test.go

  • Committer: Nicholas Skaggs
  • Date: 2016-12-02 17:28:37 UTC
  • Revision ID: nicholas.skaggs@canonical.com-20161202172837-jkrbdlyjcxtrii2n
Initial commit of 1.25.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright 2015 Canonical Ltd.
 
2
// Copyright 2015 Cloudbase Solutions SRL
 
3
// Licensed under the LGPLv3, see LICENCE file for details.
 
4
 
 
5
package commands_test
 
6
 
 
7
import (
 
8
        "github.com/juju/utils/packaging/commands"
 
9
        "github.com/juju/utils/proxy"
 
10
        gc "gopkg.in/check.v1"
 
11
)
 
12
 
 
13
var _ = gc.Suite(&YumSuite{})
 
14
 
 
15
type YumSuite struct {
 
16
        paccmder commands.PackageCommander
 
17
}
 
18
 
 
19
func (s *YumSuite) SetUpSuite(c *gc.C) {
 
20
        s.paccmder = commands.NewYumPackageCommander()
 
21
}
 
22
 
 
23
func (s *YumSuite) TestProxyConfigContentsEmpty(c *gc.C) {
 
24
        out := s.paccmder.ProxyConfigContents(proxy.Settings{})
 
25
        c.Assert(out, gc.Equals, "")
 
26
}
 
27
 
 
28
func (s *YumSuite) TestProxyConfigContentsPartial(c *gc.C) {
 
29
        sets := proxy.Settings{
 
30
                Http: "dat-proxy.zone:8080",
 
31
        }
 
32
 
 
33
        output := s.paccmder.ProxyConfigContents(sets)
 
34
        c.Assert(output, gc.Equals, "http_proxy=dat-proxy.zone:8080")
 
35
}
 
36
 
 
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",
 
42
        }
 
43
        expected := `http_proxy=dat-proxy.zone:8080
 
44
https_proxy=https://much-security.com
 
45
ftp_proxy=gimme-files.zone`
 
46
 
 
47
        output := s.paccmder.ProxyConfigContents(sets)
 
48
        c.Assert(output, gc.Equals, expected)
 
49
}