Skip to content

Commit

Permalink
test: add CliKintoneTest-128,129,130,131,132,133 (#620)
Browse files Browse the repository at this point in the history
Co-authored-by: hung-nguyen <[email protected]>
  • Loading branch information
tuanphamcybozu and hung-cybo authored Dec 8, 2023
1 parent 745d325 commit 4d8d189
Showing 1 changed file with 63 additions and 13 deletions.
76 changes: 63 additions & 13 deletions features/delete.feature
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
@isolated
Feature: cli-kintone delete command

Scenario: CliKintoneTest-19 Should delete all records of a specified Kintone app
Given The app "app_for_delete" has no records
And The app "app_for_delete" has some records as below:
| Text | Number |
| Alice | 10 |
| Bob | 20 |
| Jenny | 30 |
And Load app ID of the app "app_for_delete" as env var: "APP_ID"
And Load app token of the app "app_for_delete" with exact permissions "view,delete" as env var: "API_TOKEN"
When I run the command with args "record delete --app $APP_ID --base-url $$TEST_KINTONE_BASE_URL --api-token $API_TOKEN --yes"
Then I should get the exit code is zero
And The app "app_for_delete" should have no records

Scenario: CliKintoneTest-126 Should return the error message when the user has no privilege to delete records.
Given The app "app_for_delete" has no records
And The app "app_for_delete" has some records as below:
Expand All @@ -37,3 +24,66 @@ Feature: cli-kintone delete command
When I run the command with args "record delete --base-url $$TEST_KINTONE_BASE_URL --app $APP_ID --api-token $API_TOKEN --yes"
Then I should get the exit code is zero
And The app "app_in_space" should have no records

Scenario: CliKintoneTest-128 Should delete records when specifying an API Token and including username/password.
Given The app "app_for_delete" has no records
And The app "app_for_delete" has some records as below:
| Text | Number |
| Alice | 10 |
| Bob | 20 |
| Jenny | 30 |
And Load app ID of the app "app_for_delete" as env var: "APP_ID"
And Load app token of the app "app_for_delete" with exact permissions "view,delete" as env var: "API_TOKEN"
And Load username and password of the app "app_for_delete" with exact permissions "add" as env vars: "USERNAME" and "PASSWORD"
When I run the command with args "record delete --app $APP_ID --base-url $$TEST_KINTONE_BASE_URL --api-token $API_TOKEN --username $USERNAME --password $PASSWORD --yes"
Then I should get the exit code is zero
And The app "app_for_delete" should have no records

Scenario: CliKintoneTest-129 Should delete all records of a specified app
Given The app "app_for_delete" has no records
And The app "app_for_delete" has some records as below:
| Text | Number |
| Alice | 10 |
| Bob | 20 |
| Jenny | 30 |
And Load app ID of the app "app_for_delete" as env var: "APP_ID"
And Load app token of the app "app_for_delete" with exact permissions "view,delete" as env var: "API_TOKEN"
When I run the command with args "record delete --app $APP_ID --base-url $$TEST_KINTONE_BASE_URL --api-token $API_TOKEN --yes"
Then I should get the exit code is zero
And The app "app_for_delete" should have no records

Scenario: CliKintoneTest-130 Should return the error message when deleting the record with a draft API Token.
Given Load app ID of the app "app_for_draft_token" as env var: "APP_ID"
And Load app token of the app "app_for_draft_token" with exact permissions "view,delete" as env var: "API_TOKEN"
When I run the command with args "record delete --app $APP_ID --base-url $$TEST_KINTONE_BASE_URL --api-token $API_TOKEN --yes"
Then I should get the exit code is non-zero
And The output error message should match with the pattern: "\[520] \[GAIA_IA02] The specified API token does not match the API token generated via an app."

Scenario: CliKintoneTest-131 Should return the error message when deleting records with two valid API Token.
Given Load app ID of the app "app_for_delete" as env var: "APP_ID"
And Load app token of the app "app_for_delete" with exact permissions "view,delete" as env var: "API_TOKEN_1"
And Load app token of the app "app_for_delete" with exact permissions "view,add,delete" as env var: "API_TOKEN_2"
When I run the command with args "record delete --app $APP_ID --base-url $$TEST_KINTONE_BASE_URL --api-token $API_TOKEN_1,$API_TOKEN_2 --yes"
Then I should get the exit code is non-zero
And The output error message should match with the pattern: "\[400] \[GAIA_DA03] You cannot specify a duplicate API token for the same app."

Scenario: CliKintoneTest-132 Should delete records of specified app successfully with two valid API Tokens in different apps.
Given Load app ID of the app "app_for_delete" as env var: "APP_ID"
And The app "app_for_delete" has no records
And The app "app_for_delete" has some records as below:
| Text | Number |
| Alice | 10 |
| Bob | 20 |
| Jenny | 30 |
And Load app token of the app "app_for_delete" with exact permissions "view,delete" as env var: "API_TOKEN_1"
And Load app token of the app "app_for_export" with exact permissions "view" as env var: "API_TOKEN_2"
When I run the command with args "record delete --app $APP_ID --base-url $$TEST_KINTONE_BASE_URL --api-token $API_TOKEN_1,$API_TOKEN_2 --yes"
Then I should get the exit code is zero
And The app "app_for_delete" should have no records

Scenario: CliKintoneTest-133 Should return the error message when deleting records with valid and invalid API Tokens.
Given Load app ID of the app "app_for_delete" as env var: "APP_ID"
And Load app token of the app "app_for_delete" with exact permissions "view,delete" as env var: "API_TOKEN"
When I run the command with args "record delete --app $APP_ID --base-url $$TEST_KINTONE_BASE_URL --api-token $API_TOKEN,INVALID_API_TOKEN_2 --yes"
Then I should get the exit code is non-zero
And The output error message should match with the pattern: "\[520] \[GAIA_IA02] The specified API token does not match the API token generated via an app."

0 comments on commit 4d8d189

Please sign in to comment.