|
| 1 | +# |
| 2 | +# sonar-tools tests |
| 3 | +# Copyright (C) 2024-2025 Olivier Korach |
| 4 | +# mailto:olivier.korach AT gmail DOT com |
| 5 | +# |
| 6 | +# This program is free software; you can redistribute it and/or |
| 7 | +# modify it under the terms of the GNU Lesser General Public |
| 8 | +# License as published by the Free Software Foundation; either |
| 9 | +# version 3 of the License, or (at your option) any later version. |
| 10 | +# |
| 11 | +# This program is distributed in the hope that it will be useful, |
| 12 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | +# Lesser General Public License for more details. |
| 15 | +# |
| 16 | +# You should have received a copy of the GNU Lesser General Public License |
| 17 | +# along with this program; if not, write to the Free Software Foundation, |
| 18 | +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 19 | +# |
| 20 | + |
| 21 | +"""sonar-findings-export tests""" |
| 22 | + |
| 23 | +import os |
| 24 | +from collections.abc import Generator |
| 25 | + |
| 26 | +import utilities as tutil |
| 27 | +from sonar import errcodes as e |
| 28 | +import cli.options as opt |
| 29 | +from cli import findings_export |
| 30 | +from sonar import projects |
| 31 | +from sonar.audit import rules |
| 32 | + |
| 33 | +CMD = f"sonar-findings-export.py {tutil.SQS_OPTS}" |
| 34 | + |
| 35 | +def test_export_portfolios_findings(csv_file: Generator[str]) -> None: |
| 36 | + """test_export_portfolios_findings""" |
| 37 | + assert tutil.run_cmd(findings_export.main, f"{CMD} --portfolios --{opt.KEY_REGEXP} Banking --{opt.REPORT_FILE} {csv_file}") == e.OK |
| 38 | + # Portfolio 'Banking' has only 4 small projects and less than 300 issues in total |
| 39 | + assert tutil.csv_nbr_lines(csv_file) < 300 |
0 commit comments