Skip to content

Commit 193b6ac

Browse files
fix: update test_auth_status for new output format
1 parent 98d8e3d commit 193b6ac

1 file changed

Lines changed: 16 additions & 28 deletions

File tree

tests/test_commands/test_auth.py

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -898,9 +898,13 @@ def test_auth_logout(
898898

899899
mock_print_done.assert_called_once()
900900

901-
def test_auth_status(self, mock_fab_auth, mock_questionary_print):
901+
def test_auth_status(self, mock_fab_auth, capsys):
902902
# Arrange
903-
args = MagicMock()
903+
args = argparse.Namespace(
904+
command="auth",
905+
auth_subcommand="status",
906+
output_format=None,
907+
)
904908
with patch(
905909
"fabric_cli.commands.auth.fab_auth._get_token_info_from_bearer_token",
906910
return_value={
@@ -913,32 +917,16 @@ def test_auth_status(self, mock_fab_auth, mock_questionary_print):
913917
fab_auth.status(args)
914918

915919
# Assert
916-
assert any(
917-
"Account" in call.args[0] for call in mock_questionary_print.mock_calls
918-
)
919-
assert any(
920-
"Tenant ID" in call.args[0]
921-
for call in mock_questionary_print.mock_calls
922-
)
923-
assert any(
924-
"App ID" in call.args[0] for call in mock_questionary_print.mock_calls
925-
)
926-
assert any(
927-
"Token (fabric/powerbi)" in call.args[0]
928-
for call in mock_questionary_print.mock_calls
929-
)
930-
assert any(
931-
"Token (storage)" in call.args[0]
932-
for call in mock_questionary_print.mock_calls
933-
)
934-
assert any(
935-
"Token (azure)" in call.args[0]
936-
for call in mock_questionary_print.mock_calls
937-
)
938-
assert any(
939-
"mock************************************" in call.args[0]
940-
for call in mock_questionary_print.mock_calls
941-
)
920+
captured = capsys.readouterr()
921+
assert "account" in captured.out.lower()
922+
assert "tenant" in captured.out.lower()
923+
assert "app" in captured.out.lower()
924+
assert "token" in captured.out.lower()
925+
assert "mocked_upn" in captured.out
926+
assert "mocked_appid" in captured.out
927+
assert "mocke_oid" in captured.out
928+
assert "mocked_tenant_id" in captured.out
929+
assert "mock************************************" in captured.out
942930

943931
def test_init_when_user_cancels_the_prompt(
944932
self, mock_fab_auth, mock_fab_context, mock_fab_logger_log_warning, capsys

0 commit comments

Comments
 (0)