Skip to content

Commit

Permalink
Merge pull request #423 from CircleCI-Public/windows-unit-tests
Browse files Browse the repository at this point in the history
Make more tests pass on Windows
  • Loading branch information
marcomorain authored Jun 5, 2020
2 parents fa5217e + 2da8caf commit 423e103
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
7 changes: 7 additions & 0 deletions cmd/check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ var _ = Describe("Check", func() {
"label": "short description",
"content_type": "application/zip",
"size": 1024
},
{
"id": 1,
"name": "windows_amd64.tar.gz",
"label": "short description",
"content_type": "application/zip",
"size": 1024
}
]
}
Expand Down
9 changes: 7 additions & 2 deletions cmd/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"os"
"os/exec"
"regexp"
"runtime"

"github.com/CircleCI-Public/circleci-cli/clitest"
. "github.com/onsi/ginkgo"
Expand Down Expand Up @@ -50,7 +51,9 @@ var _ = Describe("Setup with prompts", func() {

fileInfo, err := os.Stat(tempSettings.Config.Path)
Expect(err).ToNot(HaveOccurred())
Expect(fileInfo.Mode().Perm().String()).To(Equal("-rw-------"))
if runtime.GOOS != "windows" {
Expect(fileInfo.Mode().Perm().String()).To(Equal("-rw-------"))
}
})
})

Expand All @@ -63,7 +66,9 @@ var _ = Describe("Setup with prompts", func() {

fileInfo, err := os.Stat(tempSettings.Config.Path)
Expect(err).ToNot(HaveOccurred())
Expect(fileInfo.Mode().Perm().String()).To(Equal("-rw-------"))
if runtime.GOOS != "windows" {
Expect(fileInfo.Mode().Perm().String()).To(Equal("-rw-------"))
}
})

Describe("token and host set in config file", func() {
Expand Down
6 changes: 5 additions & 1 deletion cmd/setup_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"net/http"
"os"
"path/filepath"
"runtime"

"github.com/CircleCI-Public/circleci-cli/client"
"github.com/CircleCI-Public/circleci-cli/clitest"
Expand Down Expand Up @@ -93,12 +94,15 @@ var _ = Describe("Setup with prompts", func() {

Describe("new config file", func() {
It("should set file permissions to 0600", func() {

err := setup(opts)
Expect(err).ShouldNot(HaveOccurred())

fileInfo, err := os.Stat(tempSettings.Config.Path)
Expect(err).ToNot(HaveOccurred())
Expect(fileInfo.Mode().Perm().String()).To(Equal("-rw-------"))
if runtime.GOOS != "windows" {
Expect(fileInfo.Mode().Perm().String()).To(Equal("-rw-------"))
}
})
})

Expand Down
7 changes: 7 additions & 0 deletions cmd/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ var _ = Describe("Update", func() {
"label": "short description",
"content_type": "application/zip",
"size": 1024
},
{
"id": 1,
"name": "windows_amd64.tar.gz",
"label": "short description",
"content_type": "application/zip",
"size": 1024
}
]
}
Expand Down

0 comments on commit 423e103

Please sign in to comment.