-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'openshift:main' into OSD-19729
- Loading branch information
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package utils | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
var _ = Describe("ShellChecker", func() { | ||
var ( | ||
shellChecker ShellCheckerInterface | ||
) | ||
|
||
BeforeEach(func() { | ||
shellChecker = DefaultShellChecker{} | ||
}) | ||
|
||
Context("When checking a valid shell", func() { | ||
It("Should return true for a valid shell path", func() { | ||
validShellPath := "/bin/bash" | ||
Expect(shellChecker.IsValidShell(validShellPath)).To(BeTrue()) | ||
}) | ||
|
||
It("Should return true for another valid shell path", func() { | ||
validShellPath := "/bin/zsh" | ||
Expect(shellChecker.IsValidShell(validShellPath)).To(BeTrue()) | ||
}) | ||
}) | ||
|
||
Context("When checking an invalid shell", func() { | ||
It("Should return false for an invalid shell path", func() { | ||
invalidShellPath := "/invalid/shell/path" | ||
Expect(shellChecker.IsValidShell(invalidShellPath)).To(BeFalse()) | ||
}) | ||
|
||
It("Should return false for another invalid shell path", func() { | ||
invalidShellPath := "/another/invalid/shell/path" | ||
Expect(shellChecker.IsValidShell(invalidShellPath)).To(BeFalse()) | ||
}) | ||
}) | ||
|
||
Context("When checking an empty shell path", func() { | ||
It("Should return false", func() { | ||
Expect(shellChecker.IsValidShell("")).To(BeFalse()) | ||
}) | ||
}) | ||
|
||
Context("When checking a non-existent shell path", func() { | ||
It("Should return false", func() { | ||
nonExistentShellPath := "/path/that/does/not/exist" | ||
Expect(shellChecker.IsValidShell(nonExistentShellPath)).To(BeFalse()) | ||
}) | ||
}) | ||
}) |