Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1)

Side by Side Diff: utils/apt/apt_test.go

Issue 101760045: Do not use BaseSuite in utils if not required.
Patch Set: Created 10 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « [revision details] ('k') | utils/command_test.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012, 2013 Canonical Ltd. 1 // Copyright 2012, 2013 Canonical Ltd.
2 // Licensed under the AGPLv3, see LICENCE file for details. 2 // Licensed under the AGPLv3, see LICENCE file for details.
3 3
4 package apt_test 4 package apt_test
5 5
6 import ( 6 import (
7 "fmt" 7 "fmt"
8 "io/ioutil" 8 "io/ioutil"
9 "path/filepath" 9 "path/filepath"
10 stdtesting "testing" 10 stdtesting "testing"
11 11
12 "github.com/juju/testing"
12 jc "github.com/juju/testing/checkers" 13 jc "github.com/juju/testing/checkers"
13 gc "launchpad.net/gocheck" 14 gc "launchpad.net/gocheck"
14 15
15 » "launchpad.net/juju-core/testing" 16 » "launchpad.net/juju-core/testing/testbase"
16 "launchpad.net/juju-core/utils/apt" 17 "launchpad.net/juju-core/utils/apt"
17 "launchpad.net/juju-core/utils/proxy" 18 "launchpad.net/juju-core/utils/proxy"
18 ) 19 )
19 20
20 func TestPackage(t *stdtesting.T) { 21 func TestPackage(t *stdtesting.T) {
21 gc.TestingT(t) 22 gc.TestingT(t)
22 } 23 }
23 24
24 type AptSuite struct { 25 type AptSuite struct {
25 » testing.BaseSuite 26 » testing.CleanupSuite
27 » testbase.LoggingSuite
26 } 28 }
27 29
28 var _ = gc.Suite(&AptSuite{}) 30 var _ = gc.Suite(&AptSuite{})
29 31
32 func (s *AptSuite) SetUpTest(c *gc.C) {
33 s.LoggingSuite.SetUpTest(c)
fwereade 2014/05/27 07:50:21 doesn't CleanupSuite have SetUpTest/TearDownTest?
34 }
35
36 func (s *AptSuite) TearDownTest(c *gc.C) {
37 s.LoggingSuite.TearDownTest(c)
38 }
39
30 func (s *AptSuite) TestOnePackage(c *gc.C) { 40 func (s *AptSuite) TestOnePackage(c *gc.C) {
31 cmdChan := s.HookCommandOutput(&apt.CommandOutput, []byte{}, nil) 41 cmdChan := s.HookCommandOutput(&apt.CommandOutput, []byte{}, nil)
32 err := apt.GetInstall("test-package") 42 err := apt.GetInstall("test-package")
33 c.Assert(err, gc.IsNil) 43 c.Assert(err, gc.IsNil)
34 cmd := <-cmdChan 44 cmd := <-cmdChan
35 c.Assert(cmd.Args, gc.DeepEquals, []string{ 45 c.Assert(cmd.Args, gc.DeepEquals, []string{
36 "apt-get", "--option=Dpkg::Options::=--force-confold", 46 "apt-get", "--option=Dpkg::Options::=--force-confold",
37 "--option=Dpkg::options::=--force-unsafe-io", "--assume-yes", "- -quiet", 47 "--option=Dpkg::options::=--force-unsafe-io", "--assume-yes", "- -quiet",
38 "install", "test-package", 48 "install", "test-package",
39 }) 49 })
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 222
213 type EnvironmentPatcher interface { 223 type EnvironmentPatcher interface {
214 PatchEnvironment(name, value string) 224 PatchEnvironment(name, value string)
215 } 225 }
216 226
217 func patchExecutable(patcher EnvironmentPatcher, dir, execName, script string) { 227 func patchExecutable(patcher EnvironmentPatcher, dir, execName, script string) {
218 patcher.PatchEnvironment("PATH", dir) 228 patcher.PatchEnvironment("PATH", dir)
219 filename := filepath.Join(dir, execName) 229 filename := filepath.Join(dir, execName)
220 ioutil.WriteFile(filename, []byte(script), 0755) 230 ioutil.WriteFile(filename, []byte(script), 0755)
221 } 231 }
OLDNEW
« no previous file with comments | « [revision details] ('k') | utils/command_test.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b