Simplify test by using WriteFile.

This commit is contained in:
Andrey Smirnov
2014-02-12 11:22:27 +04:00
parent c30862dff9
commit 3ba7bc7943
+2 -4
View File
@@ -1,6 +1,7 @@
package debian package debian
import ( import (
"io/ioutil"
. "launchpad.net/gocheck" . "launchpad.net/gocheck"
"os" "os"
"path/filepath" "path/filepath"
@@ -111,12 +112,9 @@ func (s *RepositorySuite) TestLinkFromPool(c *C) {
err := os.MkdirAll(filepath.Dir(t.sourcePath), 0755) err := os.MkdirAll(filepath.Dir(t.sourcePath), 0755)
c.Assert(err, IsNil) c.Assert(err, IsNil)
file, err := os.Create(t.sourcePath) err = ioutil.WriteFile(t.sourcePath, []byte("Contents"), 0644)
c.Assert(err, IsNil) c.Assert(err, IsNil)
file.Write([]byte("Contents"))
file.Close()
path, err := s.repo.LinkFromPool(t.prefix, t.component, t.sourcePath, t.poolDirectory) path, err := s.repo.LinkFromPool(t.prefix, t.component, t.sourcePath, t.poolDirectory)
c.Assert(err, IsNil) c.Assert(err, IsNil)
c.Assert(path, Equals, t.expectedFilename) c.Assert(path, Equals, t.expectedFilename)