diff --git a/src/aiida/cmdline/commands/cmd_profile.py b/src/aiida/cmdline/commands/cmd_profile.py index b434521105..42fcdb4c1e 100644 --- a/src/aiida/cmdline/commands/cmd_profile.py +++ b/src/aiida/cmdline/commands/cmd_profile.py @@ -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. @@ -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, @@ -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( diff --git a/tests/cmdline/commands/test_profile.py b/tests/cmdline/commands/test_profile.py index 781a8b3cfa..32747c61cf 100644 --- a/tests/cmdline/commands/test_profile.py +++ b/tests/cmdline/commands/test_profile.py @@ -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 @@ -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 @@ -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', @@ -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) @@ -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 @@ -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