Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
Signed-off-by: Yang Chiu <[email protected]>
  • Loading branch information
yangchiu committed Aug 20, 2024
1 parent 4be5ef4 commit 1f6697c
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions .github/workflows/qase-sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ jobs:
# if not, create new test suite
if [[ $(echo "$res" | jq .result.count) == "0" ]]; then
echo "creating new test suite ${str} with parent id ${parent_suite_id}"
res=$(curl --request POST -s \
--url https://api.qase.io/v1/suite/LH \
--header "Token: ${token}" \
--header "accept: application/json" \
--header "content-type: application/json" \
--data "{ \"title\": \"${str}\", \"parent_id\": \"${parent_suite_id}\" }")
#res=$(curl --request POST -s \
# --url https://api.qase.io/v1/suite/LH \
# --header "Token: ${token}" \
# --header "accept: application/json" \
# --header "content-type: application/json" \
# --data "{ \"title\": \"${str}\", \"parent_id\": \"${parent_suite_id}\" }")
echo "created new test suite ${str}: ${res}"
fi
Expand All @@ -107,33 +107,33 @@ jobs:
description=$(sed -z 's/\n/\\n/g' ${file_path} | sed 's/ \\/ \\\\/g')
echo "got test case description: ${description}"
res=$(curl -f -s --request GET --url "https://api.qase.io/v1/case/LH" --data-urlencode "search=${title}" --header "Token: ${token}" --header "accept: application/json")
res=$(curl -s --request GET --url "https://api.qase.io/v1/case/LH" --data-urlencode "search=${title}" --header "Token: ${token}" --header "accept: application/json")
if [[ "$(echo $res | jq .result.count) == "1" ]]; then
# update existing test case
test_case_id=$(echo $res | jq .result.entities[0].id)
res=$(curl --request PATCH -s -f \
--url "https://api.qase.io/v1/case/LH/${test_case_id}" \
--header "Token: ${token}" \
--header "accept: application/json" \
--header "content-type: application/json" \
--data "{ \"description\": \"${description}\", \"title\": "${title}" }")
#res=$(curl --request PATCH -s \
# --url "https://api.qase.io/v1/case/LH/${test_case_id}" \
# --header "Token: ${token}" \
# --header "accept: application/json" \
# --header "content-type: application/json" \
# --data "{ \"description\": \"${description}\", \"title\": "${title}" }")
echo "updated existing test case: ${res}"
else
# create new test case
parent_suite_name=$(basename $(dirname ${file_path}))
if [[ "${parent_suite_name}" == "manual" ]]; then:
parent_suite_id=""
else
res=$(curl -s -f --request GET --url "https://api.qase.io/v1/suite/LH" --data-urlencode "search=${str}" --header "Token: ${token}" --header "accept: application/json")
res=$(curl -s --request GET --url "https://api.qase.io/v1/suite/LH" --data-urlencode "search=${str}" --header "Token: ${token}" --header "accept: application/json")
parent_suite_id=$(echo "$res" | jq .result.entities[0].id)
fi
echo "creating new test case ${title} under test suite ${parent_suite_name}(${parent_suite_id})"
res=$(curl --request POST -s -f \
--url https://api.qase.io/v1/case/LH/ \
--header "Token: ${token}" \
--header "accept: application/json" \
--header "content-type: application/json" \
--data "{ \"description\": \"${description}\", \"title\": "${title}", \"suite_id\": \"${parent_suite_id}\" }")
#res=$(curl --request POST -s \
# --url https://api.qase.io/v1/case/LH/ \
# --header "Token: ${token}" \
# --header "accept: application/json" \
# --header "content-type: application/json" \
# --data "{ \"description\": \"${description}\", \"title\": "${title}", \"suite_id\": \"${parent_suite_id}\" }")
echo "created new test case ${title}: ${res}"
fi
done

0 comments on commit 1f6697c

Please sign in to comment.