-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add profile and role sorting to sso configure
This change adds sorting to profiles and roles when running `aws sso configure` listing them in ascending alphabetical order by default (case insensitive).
- Loading branch information
1 parent
da94e8c
commit 66a7bac
Showing
3 changed files
with
66 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"type": "enhancement", | ||
"category": "``sso configure``", | ||
"description": "Add sorting to accounts and roles `#6108 <https://github.com/aws/aws-cli/issues/6108>`__" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -406,6 +406,61 @@ def test_prompts_suggest_values(self): | |
] | ||
self.assert_prompt_completions(expected_completions) | ||
|
||
def test_account_list_sorted_by_name(self): | ||
selected_account = { | ||
'accountId': self.account_id, | ||
'emailAddress': '[email protected]', | ||
} | ||
first_account = { | ||
'accountId': '1111111111', | ||
'accountName': 'alpha', | ||
'emailAddress': '[email protected]' | ||
} | ||
second_account = { | ||
'accountId': '2222222222', | ||
'accountName': 'Bravo', | ||
'emailAddress': '[email protected]' | ||
} | ||
third_account = { | ||
'accountId': '3333333333', | ||
'emailAddress': '[email protected]' | ||
} | ||
accounts = [selected_account, second_account, | ||
third_account, first_account] | ||
expected_accounts = [first_account, | ||
second_account, selected_account, third_account] | ||
self._add_prompt_responses() | ||
self._add_list_accounts_response(accounts) | ||
self._add_list_account_roles_response([{'roleName': self.role_name}]) | ||
self.selector.side_effect = [selected_account] | ||
with self.sso_stub: | ||
self.configure_sso(args=[], parsed_globals=self.global_args) | ||
printed_accounts = self.selector.call_args[0][0] | ||
self.assertEqual(printed_accounts, expected_accounts) | ||
|
||
def test_role_list_sorted_by_name(self): | ||
selected_account = { | ||
'accountId': self.account_id, | ||
'emailAddress': '[email protected]', | ||
} | ||
first_role = {'roleName': 'AdministratorAccess', | ||
'accountId': self.account_id} | ||
second_role = {'roleName': 'DataScientist', | ||
'accountId': self.account_id} | ||
third_role = {'roleName': 'SystemAdministrator', | ||
'accountId': self.account_id} | ||
roles = [second_role, third_role, first_role] | ||
expected_roles = [first_role['roleName'], | ||
second_role['roleName'], third_role['roleName']] | ||
self._add_prompt_responses() | ||
self._add_list_accounts_response([selected_account]) | ||
self._add_list_account_roles_response(roles) | ||
self.selector.side_effect = [selected_account] | ||
with self.sso_stub: | ||
self.configure_sso(args=[], parsed_globals=self.global_args) | ||
printed_roles = self.selector.call_args[0][0] | ||
self.assertEqual(printed_roles, expected_roles) | ||
|
||
|
||
class TestDisplayAccount(unittest.TestCase): | ||
def setUp(self): | ||
|