Skip to content

Commit

Permalink
test: add CliKintoneTest-27,28,29 (#571)
Browse files Browse the repository at this point in the history
  • Loading branch information
tuanphamcybozu authored Nov 16, 2023
1 parent 8c62008 commit 527e130
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions features/import.feature
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,36 @@ Feature: cli-kintone import command
| Alice | 10 |
| Bob | 20 |
| Jenny | 30 |

Scenario: CliKintoneTest-27 Should return the error message when importing records with valid and invalid API Tokens
Given The csv file "CliKintoneTest-27.csv" with content as below:
| Text | Number |
| Alice | 10 |
And Load app ID of app "app_for_import" as env var: "APP_ID"
And Load app token of app "app_for_import" with exact permissions "add" as env var: "API_TOKEN_IMPORT"
When I run the command with args "record import --base-url $$TEST_KINTONE_BASE_URL --app $APP_ID --api-token $API_TOKEN_IMPORT,invalid_token --file-path CliKintoneTest-27.csv"
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-28 Should return the error message when importing records with an API Token without Add permission
Given The csv file "CliKintoneTest-28.csv" with content as below:
| Text | Number |
| Alice | 10 |
And Load app ID of app "app_for_import" as env var: "APP_ID"
And Load app token of app "app_for_import" with exact permissions "view" as env var: "API_TOKEN_VIEW"
When I run the command with args "record import --base-url $$TEST_KINTONE_BASE_URL --app $APP_ID --api-token $API_TOKEN_VIEW --file-path CliKintoneTest-28.csv"
Then I should get the exit code is non-zero
And The output error message should match with the pattern: "\[403\] \[GAIA_NO01\] Using this API token, you cannot run the specified API."

Scenario: CliKintoneTest-29 Should return the error message when updating records with an API Token without View/Edit permission
Given The csv file "CliKintoneTest-29.csv" with content as below:
| Text | Number |
| Alice | 11 |
And The app "app_for_import" has some records as below:
| Text | Number |
| Alice | 10 |
And Load app ID of app "app_for_import" as env var: "APP_ID"
And Load app token of app "app_for_import" with exact permissions "add" as env var: "API_TOKEN_IMPORT"
When I run the command with args "record import --base-url $$TEST_KINTONE_BASE_URL --app $APP_ID --api-token $API_TOKEN_IMPORT --file-path CliKintoneTest-29.csv --update-key Record_number"
Then I should get the exit code is non-zero
And The output error message should match with the pattern: "\[403\] \[GAIA_NO01\] Using this API token, you cannot run the specified API."

0 comments on commit 527e130

Please sign in to comment.