Skip to content

Commit

Permalink
test: fix status code (#892)
Browse files Browse the repository at this point in the history
  • Loading branch information
chihiro-adachi authored Oct 22, 2024
1 parent 67c77da commit d0a7c4e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions features/common.feature
Original file line number Diff line number Diff line change
Expand Up @@ -65,26 +65,26 @@ Feature: cli-kintone common test cases
Scenario: CliKintoneTest-14 Should return the error message when no authorized information
When I run the command with args "record export --base-url $$TEST_KINTONE_BASE_URL --app 1"
Then I should get the exit code is non-zero
And The output error message should match with the pattern: "\[520\] \[CB_AU01\] Please login."
And The output error message should match with the pattern: "\[401\] \[CB_AU01\] Please login."

Scenario: CliKintoneTest-15 Should return the error message when the API token is incorrect
When I run the command with args "record export --base-url $$TEST_KINTONE_BASE_URL --app 1 --api-token abc"
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."
And The output error message should match with the pattern: "\[400\] \[GAIA_IA02\] The specified API token does not match the API token generated via an app."

Scenario: CliKintoneTest-17 Should return the error message when the user information is incorrect
When I run the command with args "record export --base-url $$TEST_KINTONE_BASE_URL --app 1 --username abc --password abc"
Then I should get the exit code is non-zero
And The output error message should match with the pattern: "\[520\] \[CB_WA01\] Password authentication failed."
And The output error message should match with the pattern: "\[401\] \[CB_WA01\] Password authentication failed."

Scenario: CliKintoneTest-18 Should return the error message when authorization information is incomplete (password)
Given Load username and password of user "user_for_common" as env vars: "USERNAME" and "PASSWORD"
When I run the command with args "record export --base-url $$TEST_KINTONE_BASE_URL --app 1 --username $USERNAME"
Then I should get the exit code is non-zero
And The output error message should match with the pattern: "\[520\] \[CB_WA01\] Password authentication failed."
And The output error message should match with the pattern: "\[401\] \[CB_WA01\] Password authentication failed."

Scenario: CliKintoneTest-19 Should return the error message when incorrect authorization information (password)
Given Load username and password of user "user_for_common" as env vars: "USERNAME" and "PASSWORD"
When I run the command with args "record export --base-url $$TEST_KINTONE_BASE_URL --app 1 --username $USERNAME --password abc"
Then I should get the exit code is non-zero
And The output error message should match with the pattern: "\[520\] \[CB_WA01\] Password authentication failed."
And The output error message should match with the pattern: "\[401\] \[CB_WA01\] Password authentication failed."
4 changes: 2 additions & 2 deletions features/delete.feature
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Feature: cli-kintone delete command
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."
And The output error message should match with the pattern: "\[400] \[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"
Expand Down Expand Up @@ -86,7 +86,7 @@ Feature: cli-kintone delete command
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."
And The output error message should match with the pattern: "\[400] \[GAIA_IA02] The specified API token does not match the API token generated via an app."

Scenario: CliKintoneTest-134 Should return the error message when authorizing with username/password.
Given Load app ID of the app "app_for_delete" as env var: "APP_ID"
Expand Down
8 changes: 4 additions & 4 deletions features/export.feature
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Feature: cli-kintone export command
And Load app token of the app "app_for_draft_token" with exact permissions "view" as env var: "DRAFT_API_TOKEN"
When I run the command with args "record export --base-url $$TEST_KINTONE_BASE_URL --app $APP_ID --api-token $DRAFT_API_TOKEN"
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."
And The output error message should match with the pattern: "\[400] \[GAIA_IA02] The specified API token does not match the API token generated via an app."

Scenario: CliKintoneTest-83 Should return the error message when exporting the record with a non-relevant API Token.
Given Load app ID of the app "app_for_export" as env var: "APP_ID"
Expand Down Expand Up @@ -104,7 +104,7 @@ Feature: cli-kintone export command
And Load app token of the app "app_for_export" with exact permissions "view" as env var: "API_TOKEN_1"
When I run the command with args "record export --base-url $$TEST_KINTONE_BASE_URL --app $APP_ID --api-token $API_TOKEN_1,INVALID_API_TOKEN"
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."
And The output error message should match with the pattern: "\[400] \[GAIA_IA02] The specified API token does not match the API token generated via an app."

Scenario: CliKintoneTest-87 Should return the record contents in CSV format with --username and --password options.
Given The app "app_for_export" has no records
Expand Down Expand Up @@ -280,7 +280,7 @@ Feature: cli-kintone export command
And Load app token of the app "app_for_export" with exact permissions "view" as env var: "API_TOKEN"
When I run the command with args "record export --base-url $$TEST_KINTONE_BASE_URL --app $APP_ID --api-token $API_TOKEN --condition Unknown_Field>=20"
Then I should get the exit code is non-zero
And The output error message should match with the pattern: "\[520] \[GAIA_IQ11] Specified field \(Unknown_Field\) not found."
And The output error message should match with the pattern: "\[400] \[GAIA_IQ11] Specified field \(Unknown_Field\) not found."

Scenario: CliKintoneTest-97 Should return the record contents with valid condition query (-c option).
Given The app "app_for_export" has no records
Expand Down Expand Up @@ -324,7 +324,7 @@ Feature: cli-kintone export command
And Load app token of the app "app_for_export" with exact permissions "view" as env var: "API_TOKEN"
When I run the command with args "record export --base-url $$TEST_KINTONE_BASE_URL --app $APP_ID --api-token $API_TOKEN --order-by 'Unknown_Field desc'"
Then I should get the exit code is non-zero
And The output error message should match with the pattern: "\[520] \[GAIA_IQ11] Specified field \(Unknown_Field\) not found."
And The output error message should match with the pattern: "\[400] \[GAIA_IQ11] Specified field \(Unknown_Field\) not found."

Scenario: CliKintoneTest-100 Should return the record contents when exporting the record with --fields specified.
Given The app "app_for_export" has no records
Expand Down
4 changes: 2 additions & 2 deletions features/import.feature
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Feature: cli-kintone import command
And Load app token of the app "app_for_draft_token" 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 --file-path CliKintoneTest-24.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."
And The output error message should match with the pattern: "\[400] \[GAIA_IA02] The specified API token does not match the API token generated via an app."

Scenario: CliKintoneTest-25 Should return the error message when importing records with two valid API Token.
Given The CSV file "CliKintoneTest-25.csv" with content as below:
Expand Down Expand Up @@ -109,7 +109,7 @@ Feature: cli-kintone import command
And Load app token of the 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."
And The output error message should match with the pattern: "\[400] \[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:
Expand Down

0 comments on commit d0a7c4e

Please sign in to comment.