Skip to content

Commit

Permalink
Added test to validate access_keys leading space
Browse files Browse the repository at this point in the history
Signed-off-by: Aayush Chouhan <[email protected]>
  • Loading branch information
achouhan09 committed Jan 27, 2025
1 parent 3d4b6ba commit dd420e1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/test/unit_tests/jest_tests/test_nc_nsfs_account_cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,22 @@ describe('manage nsfs cli account flow', () => {
expect(JSON.parse(res.stdout).error.message).toBe(ManageCLIError.InvalidArgument.message);
});

it('should fail - cli create account invalid access_key(leading space in access_key)', async () => {
const { type, name, new_buckets_path } = defaults;
const account_options = { config_root, name, new_buckets_path, access_key: ' 12345678912345678ABC', secret_key: 'a234567891234567891212345678912345678912'}; // lala invalid option
const action = ACTIONS.ADD;
const res = await exec_manage_cli(type, action, account_options);
expect(JSON.parse(res.stdout).error.message).toBe(ManageCLIError.InvalidArgument.message);
});

it('should fail - cli create account invalid secret_key(leading space in secret_key)', async () => {
const { type, name, new_buckets_path } = defaults;
const account_options = { config_root, name, new_buckets_path, access_key: '12345678912345678ABC', secret_key: ' a234567891234567891212345678912345678912'}; // lala invalid option
const action = ACTIONS.ADD;
const res = await exec_manage_cli(type, action, account_options);
expect(JSON.parse(res.stdout).error.message).toBe(ManageCLIError.InvalidArgument.message);
});

it('should fail - cli create account invalid option type (user as boolean)', async () => {
const { type, name, new_buckets_path } = defaults;
const account_options = { config_root, name, new_buckets_path};
Expand Down

0 comments on commit dd420e1

Please sign in to comment.