-
Notifications
You must be signed in to change notification settings - Fork 2
/
project_test.go
49 lines (38 loc) · 1002 Bytes
/
project_test.go
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package stackcli
import (
. "gopkg.in/check.v1"
"os"
"os/exec"
"path/filepath"
"testing"
)
func TestProject(t *testing.T) { TestingT(t) }
type ProjectSuite struct{}
var _ = Suite(&ProjectSuite{})
func CleanupTest() {
rmCmd := exec.Command("rm", "-rf", "test/chef")
rmCmd.Run()
}
func (s *ProjectSuite) TestDirectoryStructure(c *C) {
CleanupTest()
project := &Project{
HomeDir: `irrelevant`,
ProjectName: `test`,
DirectoryName: `test/chef`,
TempDir: `test/fixtures/`,
}
project.CreateProjectDir()
project.CopyAndRenameFiles()
fileList := []string{}
err := filepath.Walk(project.DirectoryName, func(path string, f os.FileInfo, err error) error {
fileList = append(fileList, path)
return nil
})
if err != nil {
panic(err)
}
c.Assert(len(fileList), Equals, 6)
c.Assert(fileList[1], Equals, "test/chef/test-cookbooks")
c.Assert(fileList[3], Equals, "test/chef/test-cookbooks/test-something")
c.Assert(fileList[5], Equals, "test/chef/test-file")
}