Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard87 committed Apr 18, 2024
1 parent 60cda0e commit 6e72f38
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,21 @@ jobs:
SUBJECTS: repo:equinor/radix-oauth-guard:pull_request
GH_TOKEN: ${{ steps.get-id-token.outputs.result }}
run: |
function assert() {
local $token="${1}"
local $expected="${1}"
local $msg="${2}"
CURL_RESPONSE=$(curl --write-out '%{http_code}' --output /dev/null --header "Authorization: Bearer ${token}" http://localhost:8000/auth)
printf "Test: %15s: Result %s == %s\n" ${msg} ${expected} ${CURL_RESPONSE}
}
radix-oauth-guard &
GO_PID=$!
sleep 2s
CURL_RESPONSE=$(curl --write-out '%{http_code}' --output /dev/null --header "Authorization: Bearer ${GH_TOKEN}" http://localhost:8000/auth)
assert "${GH_TOKEN}" "200" "Valid token is OK"
kill -9 $GO_PID
echo "Curl status code: ${CURL_RESPONSE}!"
:

0 comments on commit 6e72f38

Please sign in to comment.