Skip to content

Commit

Permalink
fix: test IAM.getUser instead of listUsers (#3542)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
trivikr committed Nov 20, 2020
1 parent 24bd2a1 commit 44ded82
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions features/iam/iam.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Feature: IAM
Scenario: Users
Given I have an IAM username "js-test"
And I create an IAM user with the username
And I list the IAM users
Then the list should contain the user
And I get the IAM user
Then the IAM user should exist
And I delete the IAM user

Scenario: Roles
Expand Down
11 changes: 4 additions & 7 deletions features/iam/step_definitions/iam.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,12 @@ module.exports = function() {
this.request('iam', 'createUser', {UserName: this.iamUser}, next, false);
});

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

this.Then(/^the list should contain the user$/, function(callback) {
var name = this.iamUser;
this.assert.contains(this.data.Users, function(user) {
return user.UserName === name;
});
this.Then(/^the IAM user should exist$/, function(callback) {
this.assert.equal(this.data.User.UserName, this.iamUser);
callback();
});

Expand Down

0 comments on commit 44ded82

Please sign in to comment.