Skip to content

Commit 44ded82

Browse files
authored
fix: test IAM.getUser instead of listUsers (#3542)
The test fails if there are more than 100 users, as it parses users from first page of results. This code change explicitly requests for the created user to ensure it doesn't return pages of results.
1 parent 24bd2a1 commit 44ded82

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

features/iam/iam.feature

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ Feature: IAM
77
Scenario: Users
88
Given I have an IAM username "js-test"
99
And I create an IAM user with the username
10-
And I list the IAM users
11-
Then the list should contain the user
10+
And I get the IAM user
11+
Then the IAM user should exist
1212
And I delete the IAM user
1313

1414
Scenario: Roles

features/iam/step_definitions/iam.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,12 @@ module.exports = function() {
2121
this.request('iam', 'createUser', {UserName: this.iamUser}, next, false);
2222
});
2323

24-
this.Given(/^I list the IAM users$/, function(callback) {
25-
this.request('iam', 'listUsers', {}, callback);
24+
this.Given(/^I get the IAM user$/, function(callback) {
25+
this.request('iam', 'getUser', {UserName: this.iamUser}, callback);
2626
});
2727

28-
this.Then(/^the list should contain the user$/, function(callback) {
29-
var name = this.iamUser;
30-
this.assert.contains(this.data.Users, function(user) {
31-
return user.UserName === name;
32-
});
28+
this.Then(/^the IAM user should exist$/, function(callback) {
29+
this.assert.equal(this.data.User.UserName, this.iamUser);
3330
callback();
3431
});
3532

0 commit comments

Comments
 (0)