Skip to content

Commit

Permalink
Update tests and docs to --profile-name
Browse files Browse the repository at this point in the history
  • Loading branch information
GeigerJ2 committed Jun 27, 2024
1 parent 5407fb0 commit f842561
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions src/aiida/cmdline/commands/cmd_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def verdi_profile():


def command_create_profile(
ctx: click.Context, storage_cls, non_interactive: bool, profile: Profile, set_as_default: bool = True, **kwargs
ctx: click.Context, storage_cls, non_interactive: bool, profile_name: Profile, set_as_default: bool = True, **kwargs
):
"""Create a new profile, initialise its storage and create a default user.
Expand Down Expand Up @@ -70,9 +70,9 @@ def command_create_profile(
broker_config = None

try:
profile = create_profile(
profile_name = create_profile(
ctx.obj.config,
name=profile.name,
name=profile_name.name,
email=email,
first_name=first_name,
last_name=last_name,
Expand All @@ -85,10 +85,10 @@ def command_create_profile(
except (ValueError, TypeError, exceptions.EntryPointError, exceptions.StorageMigrationError) as exception:
echo.echo_critical(str(exception))

echo.echo_success(f'Created new profile `{profile.name}`.')
echo.echo_success(f'Created new profile `{profile_name.name}`.')

if set_as_default:
ctx.invoke(profile_set_default, profile=profile)
ctx.invoke(profile_set_default, profile=profile_name)


@verdi_profile.group(
Expand Down
12 changes: 6 additions & 6 deletions tests/cmdline/commands/test_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def test_delete_storage(run_cli_command, isolated_config, tmp_path, entry_point)
else:
filepath = tmp_path / 'storage'

options = [entry_point, '-n', '--filepath', str(filepath), '--profile', profile_name, '--email', 'email@host']
options = [entry_point, '-n', '--filepath', str(filepath), '--profile-name', profile_name, '--email', 'email@host']
result = run_cli_command(cmd_profile.profile_setup, options, use_subprocess=False)
assert filepath.exists()
assert profile_name in isolated_config.profile_names
Expand Down Expand Up @@ -204,7 +204,7 @@ def test_setup(config_psql_dos, run_cli_command, isolated_config, tmp_path, entr
options = ['--filepath', str(tmp_path)]

profile_name = 'temp-profile'
options = [entry_point, '-n', '--profile', profile_name, '--email', 'email@host', *options]
options = [entry_point, '-n', '--profile-name', profile_name, '--email', 'email@host', *options]
result = run_cli_command(cmd_profile.profile_setup, options, use_subprocess=False)
assert f'Created new profile `{profile_name}`.' in result.output
assert profile_name in isolated_config.profile_names
Expand All @@ -221,7 +221,7 @@ def test_setup_set_as_default(run_cli_command, isolated_config, tmp_path, set_as
'-n',
'--filepath',
str(tmp_path),
'--profile',
'--profile-name',
profile_name,
'--email',
'email@host',
Expand All @@ -247,7 +247,7 @@ def test_setup_email_required(run_cli_command, isolated_config, tmp_path, entry_

isolated_config.unset_option('autofill.user.email')

options = [entry_point, '-n', '--filepath', str(tmp_path), '--profile', profile_name]
options = [entry_point, '-n', '--filepath', str(tmp_path), '--profile-name', profile_name]

if storage_cls.read_only:
result = run_cli_command(cmd_profile.profile_setup, options, use_subprocess=False)
Expand All @@ -261,7 +261,7 @@ def test_setup_email_required(run_cli_command, isolated_config, tmp_path, entry_
def test_setup_no_use_rabbitmq(run_cli_command, isolated_config):
"""Test the ``--no-use-rabbitmq`` option."""
profile_name = 'profile-no-broker'
options = ['core.sqlite_dos', '-n', '--email', 'a@a', '--profile', profile_name, '--no-use-rabbitmq']
options = ['core.sqlite_dos', '-n', '--email', 'a@a', '--profile-name', profile_name, '--no-use-rabbitmq']

result = run_cli_command(cmd_profile.profile_setup, options, use_subprocess=False)
assert f'Created new profile `{profile_name}`.' in result.output
Expand All @@ -276,7 +276,7 @@ def test_configure_rabbitmq(run_cli_command, isolated_config):
profile_name = 'profile'

# First setup a profile without a broker configured
options = ['core.sqlite_dos', '-n', '--email', 'a@a', '--profile', profile_name, '--no-use-rabbitmq']
options = ['core.sqlite_dos', '-n', '--email', 'a@a', '--profile-name', profile_name, '--no-use-rabbitmq']
run_cli_command(cmd_profile.profile_setup, options, use_subprocess=False)
profile = isolated_config.get_profile(profile_name)
assert profile.process_control_backend is None
Expand Down

0 comments on commit f842561

Please sign in to comment.