From 4fc016dad9fede29030ffd01c5e604f866535206 Mon Sep 17 00:00:00 2001 From: Lucas Bruno Date: Thu, 18 Nov 2021 08:42:23 -0300 Subject: [PATCH] e2e: test for disable docker and repository name (#781) Signed-off-by: lucas.bruno --- e2e/commands/start/start_test.go | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/e2e/commands/start/start_test.go b/e2e/commands/start/start_test.go index f8a046234..beea02cec 100644 --- a/e2e/commands/start/start_test.go +++ b/e2e/commands/start/start_test.go @@ -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" ) @@ -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()) @@ -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{ @@ -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", } }) @@ -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))) + }) + }) })