mirror of
https://github.com/zhigang1992/actions.git
synced 2026-01-12 08:53:47 +08:00
Added test cases for get-payload and get-task
This commit is contained in:
25
github-deploy/test/deployment-get-payload.bats
Normal file
25
github-deploy/test/deployment-get-payload.bats
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
#load bootstrap
|
||||
|
||||
PATH="$PATH:$BATS_TEST_DIRNAME/../bin"
|
||||
|
||||
export GITHUB_EVENT_PATH="$BATS_TEST_DIRNAME/fixtures/deployment.json"
|
||||
|
||||
@test "return error code if not given a parameter" {
|
||||
run deployment-get-payload
|
||||
[ "$status" -eq 64 ]
|
||||
}
|
||||
|
||||
@test "returns correct payload item" {
|
||||
run deployment-get-payload test_payload
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "value" ]
|
||||
}
|
||||
|
||||
|
||||
@test "returns empty string if payload does not exist" {
|
||||
run deployment-get-payload foo_payload
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "" ]
|
||||
}
|
||||
11
github-deploy/test/deployment-get-task.bats
Normal file
11
github-deploy/test/deployment-get-task.bats
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
PATH="$PATH:$BATS_TEST_DIRNAME/../bin"
|
||||
|
||||
export GITHUB_EVENT_PATH="$BATS_TEST_DIRNAME/fixtures/deployment.json"
|
||||
|
||||
@test "returs deployment task" {
|
||||
run deployment-get-task
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "deploy" ]
|
||||
}
|
||||
3
github-deploy/test/fixtures/deployment.json
vendored
3
github-deploy/test/fixtures/deployment.json
vendored
@@ -7,6 +7,9 @@
|
||||
"ref": "master",
|
||||
"task": "deploy",
|
||||
"payload": {
|
||||
"config": {
|
||||
"test_payload": "value"
|
||||
}
|
||||
},
|
||||
"environment": "production",
|
||||
"description": null,
|
||||
|
||||
Reference in New Issue
Block a user