File: copyfile_test.go

package info (click to toggle)
aptly 1.6.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 49,928 kB
  • sloc: python: 10,398; sh: 252; makefile: 184
file content (28 lines) | stat: -rw-r--r-- 516 bytes parent folder | download | duplicates (3)
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
package utils

import (
	"os"
	"path/filepath"

	. "gopkg.in/check.v1"
)

type CopyfileSuite struct {
	source *os.File
	dest   string
}

var _ = Suite(&CopyfileSuite{})

func (s *CopyfileSuite) SetUpSuite(c *C) {
	s.source, _ = os.CreateTemp(c.MkDir(), "source-file")
	s.dest = filepath.Join(filepath.Dir(s.source.Name()), "destination-file")
}

func (s *CopyfileSuite) TestCopyFile(c *C) {
	err := CopyFile(s.source.Name(), s.dest)
	c.Check(err, Equals, nil)

	_, err = os.Stat(s.dest)
	c.Check(err, Equals, nil)
}