Skip to content

Commit

Permalink
✅ Add test for more complex passwords
Browse files Browse the repository at this point in the history
  • Loading branch information
Lars Gohr committed Aug 29, 2020
1 parent 8e555d3 commit 94e33a1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 3 additions & 1 deletion mock.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/bin/bash
binary="$0"
parameters="$@"
echo "${binary} ${parameters}" >> mockCalledWith
echo "${binary} ${parameters}" >> mockArgs
stdin=$(cat -)
echo "${binary} ${stdin}" >> mockStdin

function mockShouldFail() {
[ "${MOCK_RETURNS[${binary}]}" = "_${parameters}" ]
Expand Down
19 changes: 18 additions & 1 deletion test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,15 @@ teardown() {
+ sanitize my/repository name"
}

@test "it is ok with complexer passwords" {
export GITHUB_REF='refs/heads/master'
export INPUT_PASSWORD='9eL89n92G@!#o^$!&3Nz89F@%9'

run /entrypoint.sh

expectMockArgs '/usr/local/bin/docker 9eL89n92G@!#o^$!&3Nz89F@%9'
}

expectStdOutContains() {
local expected=$(echo "${1}" | tr -d '\n')
local got=$(echo "${output}" | tr -d '\n')
Expand All @@ -601,7 +610,15 @@ expectStdOutContains() {

expectMockCalled() {
local expected=$(echo "${1}" | tr -d '\n')
local got=$(cat mockCalledWith | tr -d '\n')
local got=$(cat mockArgs | tr -d '\n')
echo "Expected: |${expected}|
Got: |${got}|"
echo "${got}" | grep "${expected}"
}

expectMockArgs() {
local expected=$(echo "${1}" | tr -d '\n')
local got=$(cat mockStdin | tr -d '\n')
echo "Expected: |${expected}|
Got: |${got}|"
echo "${got}" | grep "${expected}"
Expand Down

0 comments on commit 94e33a1

Please sign in to comment.