Skip to content

Commit

Permalink
test: add test cases CliKintoneTest-51,52,53 (#584)
Browse files Browse the repository at this point in the history
  • Loading branch information
tuanphamcybozu authored Nov 23, 2023
1 parent 0b37797 commit 7ab9337
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions features/import.feature
Original file line number Diff line number Diff line change
Expand Up @@ -342,3 +342,50 @@ Feature: cli-kintone import command
When I run the command with args "record import --base-url $$TEST_KINTONE_BASE_URL --app $APP_ID --api-token $API_TOKEN --attachments-dir ./attachments --file-path 9f56a2be-c8f0-4ecc-8f62-b5b430e34e25.csv"
Then I should get the exit code is non-zero
And The output error message should match with the pattern: "Error: ENOENT: no such file or directory"

Scenario: CliKintoneTest-51 Should import the records successfully with --fields specified.
Given The app "app_for_import" has no records
And The csv file "CliKintoneTest-51.csv" with content as below:
| Text | Number |
| Alice | 10 |
| Bob | 20 |
| Jenny | 30 |
And Load app ID of the app "app_for_import" as env var: "APP_ID"
And Load app token of the app "app_for_import" with exact permissions "add" as env var: "API_TOKEN"
When I run the command with args "record import --base-url $$TEST_KINTONE_BASE_URL --app $APP_ID --api-token $API_TOKEN --fields Text --file-path CliKintoneTest-51.csv"
Then I should get the exit code is zero
And The app "app_for_import" should has records as below:
| Text | Number |
| Alice | |
| Bob | |
| Jenny | |

Scenario: CliKintoneTest-52 Should import the records successfully with --fields specified multiple existent field codes.
Given The app "app_for_import" has no records
And The csv file "CliKintoneTest-52.csv" with content as below:
| Text | Number |
| Alice | 10 |
| Bob | 20 |
| Jenny | 30 |
And Load app ID of the app "app_for_import" as env var: "APP_ID"
And Load app token of the app "app_for_import" with exact permissions "add" as env var: "API_TOKEN"
When I run the command with args "record import --base-url $$TEST_KINTONE_BASE_URL --app $APP_ID --api-token $API_TOKEN --fields Text,Number --file-path CliKintoneTest-52.csv"
Then I should get the exit code is zero
And The app "app_for_import" should has records as below:
| Text | Number |
| Alice | 10 |
| Bob | 20 |
| Jenny | 30 |

Scenario: CliKintoneTest-53 Should return the error message when importing records with --fields specified, including existent and non-existent field codes.
Given The app "app_for_import" has no records
And The csv file "CliKintoneTest-53.csv" with content as below:
| Text | Number |
| Alice | 10 |
| Bob | 20 |
| Jenny | 30 |
And Load app ID of the app "app_for_import" as env var: "APP_ID"
And Load app token of the app "app_for_import" with exact permissions "add" as env var: "API_TOKEN"
When I run the command with args "record import --base-url $$TEST_KINTONE_BASE_URL --app $APP_ID --api-token $API_TOKEN --fields Text,Non_Existent_Field_Code --file-path CliKintoneTest-53.csv"
Then I should get the exit code is non-zero
And The output error message should match with the pattern: "Error: The specified field \"Non_Existent_Field_Code\" does not exist on the app"

0 comments on commit 7ab9337

Please sign in to comment.