Skip to content

Commit ae9710c

Browse files
committed
ombine tests to avoid depandency (in more cases)
Signed-off-by: shirady <57721533+shirady@users.noreply.github.com>
1 parent 7fcf4a6 commit ae9710c

1 file changed

Lines changed: 26 additions & 28 deletions

File tree

src/test/unit_tests/test_nc_iam_basic_integration.js

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,14 @@ mocha.describe('IAM basic integration tests - happy path', async function() {
101101
const command = new UpdateUserCommand(input);
102102
const response = await iam_account.send(command);
103103
_check_status_code_ok(response);
104-
});
105104

106-
mocha.it('list users - should have 1 user in the list (after updating the username)', async function() {
107-
const input = {};
108-
const command = new ListUsersCommand(input);
109-
const response = await iam_account.send(command);
110-
_check_status_code_ok(response);
111-
assert.equal(response.Users.length, 1);
112-
assert.equal(response.Users[0].UserName, new_username);
105+
// verify it using list users
106+
const input2 = {};
107+
const command2 = new ListUsersCommand(input2);
108+
const response2 = await iam_account.send(command2);
109+
_check_status_code_ok(response2);
110+
assert.equal(response2.Users.length, 1);
111+
assert.equal(response2.Users[0].UserName, new_username);
113112
});
114113

115114
mocha.it('delete a user', async function() {
@@ -155,6 +154,7 @@ mocha.describe('IAM basic integration tests - happy path', async function() {
155154
const command = new ListAccessKeysCommand(input);
156155
const response = await iam_account.send(command);
157156
_check_status_code_ok(response);
157+
assert.equal(response.AccessKeyMetadata.length, 0);
158158
});
159159

160160
mocha.it('create access keys', async function() {
@@ -169,19 +169,18 @@ mocha.describe('IAM basic integration tests - happy path', async function() {
169169
access_key_id = response.AccessKey.AccessKeyId;
170170
assert(response.AccessKey.SecretAccessKey !== undefined);
171171
assert.equal(response.AccessKey.Status, ACCESS_KEY_STATUS_ENUM.ACTIVE);
172-
});
173172

174-
mocha.it('list access keys - should have 1 access key', async function() {
175-
const input = {
173+
// verify it using list access keys
174+
const input2 = {
176175
UserName: username2
177176
};
178-
const command = new ListAccessKeysCommand(input);
179-
const response = await iam_account.send(command);
180-
_check_status_code_ok(response);
181-
assert.equal(response.AccessKeyMetadata.length, 1);
182-
assert.equal(response.AccessKeyMetadata[0].UserName, username2);
183-
assert.equal(response.AccessKeyMetadata[0].AccessKeyId, access_key_id);
184-
assert.equal(response.AccessKeyMetadata[0].Status, ACCESS_KEY_STATUS_ENUM.ACTIVE);
177+
const command2 = new ListAccessKeysCommand(input2);
178+
const response2 = await iam_account.send(command2);
179+
_check_status_code_ok(response2);
180+
assert.equal(response2.AccessKeyMetadata.length, 1);
181+
assert.equal(response2.AccessKeyMetadata[0].UserName, username2);
182+
assert.equal(response2.AccessKeyMetadata[0].AccessKeyId, access_key_id);
183+
assert.equal(response2.AccessKeyMetadata[0].Status, ACCESS_KEY_STATUS_ENUM.ACTIVE);
185184
});
186185

187186
mocha.it('get access key (last used)', async function() {
@@ -206,19 +205,18 @@ mocha.describe('IAM basic integration tests - happy path', async function() {
206205
const command = new UpdateAccessKeyCommand(input);
207206
const response = await iam_account.send(command);
208207
_check_status_code_ok(response);
209-
});
210208

211-
mocha.it('list access keys - should have 1 access key (with inactive status)', async function() {
212-
const input = {
209+
// verify it using list access keys
210+
const input2 = {
213211
UserName: username2
214212
};
215-
const command = new ListAccessKeysCommand(input);
216-
const response = await iam_account.send(command);
217-
_check_status_code_ok(response);
218-
assert.equal(response.AccessKeyMetadata.length, 1);
219-
assert.equal(response.AccessKeyMetadata[0].UserName, username2);
220-
assert.equal(response.AccessKeyMetadata[0].AccessKeyId, access_key_id);
221-
assert.equal(response.AccessKeyMetadata[0].Status, ACCESS_KEY_STATUS_ENUM.INACTIVE);
213+
const command2 = new ListAccessKeysCommand(input2);
214+
const response2 = await iam_account.send(command2);
215+
_check_status_code_ok(response2);
216+
assert.equal(response2.AccessKeyMetadata.length, 1);
217+
assert.equal(response2.AccessKeyMetadata[0].UserName, username2);
218+
assert.equal(response2.AccessKeyMetadata[0].AccessKeyId, access_key_id);
219+
assert.equal(response2.AccessKeyMetadata[0].Status, ACCESS_KEY_STATUS_ENUM.INACTIVE);
222220
});
223221

224222
mocha.it('delete access keys', async function() {

0 commit comments

Comments
 (0)