Skip to content

Remove the -a option from slcli user create #1377

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions SoftLayer/CLI/user/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@
"supersedes this template.")
@click.option('--template', '-t', default=None,
help="A json string describing https://softlayer.github.io/reference/datatypes/SoftLayer_User_Customer/")
@click.option('--api-key', '-a', default=False, is_flag=True, help="Create an API key for this user.")
@environment.pass_env
def cli(env, username, email, password, from_user, template, api_key):
def cli(env, username, email, password, from_user, template):
"""Creates a user Users.

Remember to set the permissions and access for this new user.
Expand Down Expand Up @@ -81,13 +80,9 @@ def cli(env, username, email, password, from_user, template, api_key):
raise exceptions.CLIAbort("Canceling creation!")

result = mgr.create_user(user_template, password)
new_api_key = None
if api_key:
click.secho("Adding API key...", fg='green')
new_api_key = mgr.add_api_authentication_key(result['id'])

table = formatting.Table(['Username', 'Email', 'Password', 'API Key'])
table.add_row([result['username'], result['email'], password, new_api_key])
table = formatting.Table(['Username', 'Email', 'Password'])
table.add_row([result['username'], result['email'], password])
env.fout(table)


Expand Down
3 changes: 1 addition & 2 deletions tests/CLI/modules/user_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,8 @@ def test_create_user_generate_password_2(self, confirm_mock):
@mock.patch('SoftLayer.CLI.formatting.confirm')
def test_create_user_and_apikey(self, confirm_mock):
confirm_mock.return_value = True
result = self.run_command(['user', 'create', 'test', '-e', '[email protected]', '-a'])
result = self.run_command(['user', 'create', 'test', '-e', '[email protected]'])
self.assert_no_fail(result)
self.assert_called_with('SoftLayer_User_Customer', 'addApiAuthenticationKey')

@mock.patch('SoftLayer.CLI.formatting.confirm')
def test_create_user_with_template(self, confirm_mock):
Expand Down