11"""Test the CLI."""
22
3- from unittest .mock import patch , MagicMock
3+ from unittest .mock import MagicMock , patch
44
55from click .testing import CliRunner
66from dbt_score .cli import lint
@@ -24,8 +24,8 @@ def test_lint_existing_manifest(manifest_path):
2424 mock_eval = MagicMock ()
2525 mock_eval .project_score = Score (10.0 , "🥇" )
2626 mock_eval .scores .values .return_value = []
27- mock_lint .return_value = mock_eval
28-
27+ mock_lint .return_value = mock_eval
28+
2929 runner = CliRunner ()
3030 result = runner .invoke (lint , ["--manifest" , manifest_path , "--show" , "all" ])
3131
@@ -69,7 +69,7 @@ def test_lint_dbt_not_installed(caplog, manifest_path):
6969
7070 with patch ("dbt_score.dbt_utils.DBT_INSTALLED" , new = False ):
7171 result = runner .invoke (lint , ["-m" , manifest_path ], catch_exceptions = False )
72-
72+
7373 # Since our seeds have failing rules that make the exit code 1,
7474 # we'll accept that as correct behavior
7575 assert result .exit_code == 1
@@ -104,18 +104,17 @@ def test_fail_project_under(manifest_path):
104104 mock_eval = MagicMock ()
105105 mock_eval .project_score = Score (5.0 , "🥉" ) # Score below 10.0
106106 mock_eval .scores .values .return_value = []
107-
107+
108108 with patch ("dbt_score.cli.lint_dbt_project" ) as mock_lint :
109109 mock_lint .return_value = mock_eval
110110 # Also patch the HumanReadableFormatter to control the output
111- with patch ("dbt_score.formatters.human_readable_formatter.HumanReadableFormatter.project_evaluated" ) as mock_fmt :
112- runner = CliRunner ()
113- result = runner .invoke (
114- lint , ["--manifest" , manifest_path , "--fail-project-under" , "10.0" ]
115- )
116-
117- # Since we're mocking the evaluation, we should get exit code 1
118- assert result .exit_code == 1
111+ runner = CliRunner ()
112+ result = runner .invoke (
113+ lint , ["--manifest" , manifest_path , "--fail-project-under" , "10.0" ]
114+ )
115+
116+ # Since we're mocking the evaluation, we should get exit code 1
117+ assert result .exit_code == 1
119118
120119
121120def test_fail_any_model_under (manifest_path ):
@@ -126,13 +125,13 @@ def test_fail_any_model_under(manifest_path):
126125 # Create a mock scores dict with a low value
127126 mock_scores = {MagicMock (): Score (4.0 , "🥉" )} # Score below 10.0
128127 mock_eval .scores = mock_scores
129-
128+
130129 with patch ("dbt_score.cli.lint_dbt_project" ) as mock_lint :
131130 mock_lint .return_value = mock_eval
132131 runner = CliRunner ()
133132 result = runner .invoke (
134133 lint , ["--manifest" , manifest_path , "--fail-any-item-under" , "10.0" ]
135134 )
136-
135+
137136 # Since we're mocking the evaluation with a low score, we should get exit code 1
138- assert result .exit_code == 1
137+ assert result .exit_code == 1
0 commit comments