Skip to content

Commit 8bf63e0

Browse files
committed
fix: Remove profiles_current
This is redundant with cforge whoami #13 Branch: Profiles-13 Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
1 parent f7eaca3 commit 8bf63e0

3 files changed

Lines changed: 0 additions & 125 deletions

File tree

cforge/commands/settings/profiles.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -171,27 +171,6 @@ def profiles_switch(
171171
raise typer.Exit(1)
172172

173173

174-
def profiles_current() -> None:
175-
"""Show the currently active profile.
176-
177-
Displays information about which profile is currently being used by the CLI.
178-
"""
179-
console = get_console()
180-
181-
try:
182-
profile = get_active_profile()
183-
184-
console.print(f"\n[bold green]Current Profile:[/bold green] [cyan]{profile.name}[/cyan]")
185-
console.print(f"[dim]Email:[/dim] {profile.email}")
186-
console.print(f"[dim]API URL:[/dim] {profile.api_url}")
187-
if profile.metadata and profile.metadata.environment:
188-
console.print(f"[dim]Environment:[/dim] {profile.metadata.environment}")
189-
190-
except Exception as e:
191-
console.print(f"[red]Error retrieving current profile: {str(e)}[/red]")
192-
raise typer.Exit(1)
193-
194-
195174
def profiles_create() -> None:
196175
"""Create a new profile interactively.
197176

cforge/main.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@
132132
profiles_app.command("list")(profiles.profiles_list)
133133
profiles_app.command("get")(profiles.profiles_get)
134134
profiles_app.command("switch")(profiles.profiles_switch)
135-
profiles_app.command("current")(profiles.profiles_current)
136135
profiles_app.command("create")(profiles.profiles_create)
137136

138137
# ---------------------------------------------------------------------------

tests/commands/settings/test_profiles.py

Lines changed: 0 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
# First-Party
1919
from cforge.commands.settings.profiles import (
2020
profiles_create,
21-
profiles_current,
2221
profiles_get,
2322
profiles_list,
2423
profiles_switch,
@@ -535,108 +534,6 @@ def test_profiles_switch_failed_to_switch(self, mock_console, mock_settings) ->
535534
assert any("Failed to switch to profile" in str(call) for call in mock_console.print.call_args_list)
536535

537536

538-
class TestProfilesCurrent:
539-
"""Tests for profiles current command."""
540-
541-
def test_profiles_current_success(self, mock_console, mock_settings) -> None:
542-
"""Test showing the current profile."""
543-
profile = AuthProfile(
544-
id="profile-1",
545-
name="Current Profile",
546-
email="current@example.com",
547-
apiUrl="https://api.example.com",
548-
isActive=True,
549-
createdAt=datetime.now(),
550-
metadata=ProfileMetadata(environment="production"),
551-
)
552-
553-
store = ProfileStore(
554-
profiles={"profile-1": profile},
555-
activeProfileId="profile-1",
556-
)
557-
save_profile_store(store)
558-
559-
with patch("cforge.commands.settings.profiles.get_console", return_value=mock_console):
560-
profiles_current()
561-
562-
# Verify current profile was shown
563-
print_calls = [str(call) for call in mock_console.print.call_args_list]
564-
assert any("Current Profile" in call for call in print_calls)
565-
assert any("current@example.com" in call for call in print_calls)
566-
assert any("production" in call for call in print_calls)
567-
568-
def test_profiles_current_none_set(self, mock_console, mock_settings) -> None:
569-
"""Test showing current profile when none is set (should show default)."""
570-
with patch("cforge.commands.settings.profiles.get_console", return_value=mock_console):
571-
profiles_current()
572-
573-
# Should show the virtual default profile
574-
print_calls = [str(call) for call in mock_console.print.call_args_list]
575-
assert any("Local Default" in call for call in print_calls)
576-
577-
def test_profiles_current_with_environment(self, mock_console, mock_settings) -> None:
578-
"""Test showing current profile with environment metadata."""
579-
profile = AuthProfile(
580-
id="profile-1",
581-
name="Current Profile",
582-
email="current@example.com",
583-
apiUrl="https://api.example.com",
584-
isActive=True,
585-
createdAt=datetime.now(),
586-
metadata=ProfileMetadata(environment="staging"),
587-
)
588-
589-
store = ProfileStore(
590-
profiles={"profile-1": profile},
591-
activeProfileId="profile-1",
592-
)
593-
save_profile_store(store)
594-
595-
with patch("cforge.commands.settings.profiles.get_console", return_value=mock_console):
596-
profiles_current()
597-
598-
# Verify environment is shown
599-
print_calls = [str(call) for call in mock_console.print.call_args_list]
600-
assert any("Environment" in call and "staging" in call for call in print_calls)
601-
602-
def test_profiles_current_error(self, mock_console, mock_settings) -> None:
603-
"""Test showing current profile with an error."""
604-
with patch("cforge.commands.settings.profiles.get_console", return_value=mock_console):
605-
with patch("cforge.commands.settings.profiles.get_active_profile", side_effect=Exception("Test error")):
606-
with pytest.raises(typer.Exit) as exc_info:
607-
profiles_current()
608-
609-
assert exc_info.value.exit_code == 1
610-
assert any("Error retrieving current profile" in str(call) for call in mock_console.print.call_args_list)
611-
612-
def test_profiles_current_no_environment(self, mock_console, mock_settings) -> None:
613-
"""Test showing the current profile works when environment is unset."""
614-
profile = AuthProfile(
615-
id="profile-1",
616-
name="Current Profile",
617-
email="current@example.com",
618-
apiUrl="https://api.example.com",
619-
isActive=True,
620-
createdAt=datetime.now(),
621-
metadata=ProfileMetadata(isInternal=True),
622-
)
623-
624-
store = ProfileStore(
625-
profiles={"profile-1": profile},
626-
activeProfileId="profile-1",
627-
)
628-
save_profile_store(store)
629-
630-
with patch("cforge.commands.settings.profiles.get_console", return_value=mock_console):
631-
profiles_current()
632-
633-
# Verify current profile was shown
634-
print_calls = [str(call) for call in mock_console.print.call_args_list]
635-
assert any("Current Profile" in call for call in print_calls)
636-
assert any("current@example.com" in call for call in print_calls)
637-
assert not any("Environment:" in call for call in print_calls)
638-
639-
640537
class TestProfilesCreate:
641538
"""Tests for profiles create command."""
642539

0 commit comments

Comments
 (0)