From 98001adef8f1364e6386b8659ac7b0eafda6ec03 Mon Sep 17 00:00:00 2001 From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com> Date: Fri, 20 Nov 2020 14:42:33 -0800 Subject: [PATCH] fix: test IAM.getUser instead of listUsers 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. --- features/iam/iam.feature | 4 ++-- features/iam/step_definitions/iam.js | 11 ++++------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/features/iam/iam.feature b/features/iam/iam.feature index 9244762ef2..2924f91c54 100644 --- a/features/iam/iam.feature +++ b/features/iam/iam.feature @@ -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 diff --git a/features/iam/step_definitions/iam.js b/features/iam/step_definitions/iam.js index 4a296221bd..d62fd48776 100644 --- a/features/iam/step_definitions/iam.js +++ b/features/iam/step_definitions/iam.js @@ -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(); });