Skip to content

Commit

Permalink
e2e: test for disable docker and repository name (#781)
Browse files Browse the repository at this point in the history
Signed-off-by: lucas.bruno <lucas.bruno@zup.com.br>
  • Loading branch information
lucasbrunozup authored Nov 18, 2021
1 parent 7f80151 commit 4fc016d
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions e2e/commands/start/start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@ package start_test

import (
"fmt"
"os"
"path/filepath"

"github.com/ZupIT/horusec-devkit/pkg/utils/logger/enums"
"github.com/ZupIT/horusec/internal/enums/outputtype"
"github.com/google/uuid"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
"os"
"path/filepath"

"github.com/ZupIT/horusec-devkit/pkg/utils/logger/enums"
"github.com/ZupIT/horusec/internal/enums/outputtype"
"github.com/ZupIT/horusec/internal/utils/testutil"
)

Expand All @@ -38,6 +37,7 @@ var _ = Describe("running binary Horusec with start parameter", func() {

JustBeforeEach(func() {
var err error
flags[testutil.StartFlagDisableDocker] = "true"
cmd := testutil.GinkgoGetHorusecCmdWithFlags(testutil.CmdStart, flags)
session, err = gexec.Start(cmd, GinkgoWriter, GinkgoWriter)
Expect(err).NotTo(HaveOccurred())
Expand Down Expand Up @@ -95,6 +95,12 @@ var _ = Describe("running binary Horusec with start parameter", func() {
})
})

When("--disable-docker is passed", func() {
It("Checks if the disable docker was set as true", func() {
Expect(session.Out.Contents()).To(ContainSubstring(`\"disable_docker\": true`))
})
})

When("--project-path is passed", func() {
BeforeEach(func() {
flags = map[string]string{
Expand Down Expand Up @@ -233,7 +239,6 @@ var _ = Describe("running binary Horusec with start parameter", func() {
flags = map[string]string{
testutil.StartFlagProjectPath: projectPath,
testutil.StartFlagReturnError: "true",
testutil.StartFlagDisableDocker: "true",
}
})

Expand Down Expand Up @@ -276,4 +281,19 @@ var _ = Describe("running binary Horusec with start parameter", func() {
Expect(session.Out.Contents()).To(ContainSubstring("YOUR ANALYSIS HAD FINISHED WITHOUT ANY VULNERABILITY!"))
})
})

When("--repository-name is passed", func() {
repositoryName := "horusec-e2e-test"

BeforeEach(func() {
flags = map[string]string{
testutil.StartFlagProjectPath: projectPath,
testutil.StartFlagRepositoryName: repositoryName,
}
})

It("Checks if the repository name property was set", func() {
Expect(session.Out.Contents()).To(ContainSubstring(fmt.Sprintf(`\"repository_name\": \"%s\"`, repositoryName)))
})
})
})

0 comments on commit 4fc016d

Please sign in to comment.