def test_as_text(mock_config, mock_revision): """ Test text export for ClangTidyIssue """ from code_review_bot.tasks.lint import MozLintIssue issue = MozLintIssue( "test.py", 1, "error", 1, "flake8", "dummy test withUppercaseChars", "dummy rule", mock_revision, ) assert (issue.as_text() == "Error: Dummy test withUppercaseChars [flake8: dummy rule]") assert issue.as_phabricator_lint() == { "char": 1, "code": "flake8.dummy rule", "line": 1, "name": "MozLint Flake8 - dummy rule", "description": "dummy test withUppercaseChars", "path": "test.py", "severity": "error", }
def test_as_text(mock_config, mock_revision, mock_hgmo, mock_task): """ Test text export for ClangTidyIssue """ issue = MozLintIssue( mock_task(MozLintTask, "mock-lint-flake8"), "test.py", 1, "error", 1, "flake8", "dummy test withUppercaseChars", "dummy rule", mock_revision, ) assert (issue.as_text() == "Error: Dummy test withUppercaseChars [flake8: dummy rule]") assert issue.as_phabricator_lint() == { "char": 1, "code": "dummy rule", "line": 1, "name": "mock-lint-flake8", "description": "(IMPORTANT) ERROR: dummy test withUppercaseChars", "path": "test.py", "severity": "error", } assert issue.as_dict() == { "analyzer": "mock-lint-flake8", "check": "dummy rule", "column": 1, "in_patch": False, "level": "error", "line": 1, "message": "dummy test withUppercaseChars", "nb_lines": 1, "path": "test.py", "publishable": True, "validates": True, "hash": "f8d818d42677f3ffdc0be647453278b8", "fix": None, }
def test_as_text(mock_config, mock_revision, mock_hgmo): """ Test text export for ClangTidyIssue """ issue = MozLintIssue( "mock-lint-flake8", "test.py", 1, "error", 1, "flake8", "dummy test withUppercaseChars", "dummy rule", mock_revision, ) assert (issue.as_text() == "Error: Dummy test withUppercaseChars [flake8: dummy rule]") assert issue.as_phabricator_lint() == { "char": 1, "code": "dummy rule", "line": 1, "name": "mock-lint-flake8", "description": "dummy test withUppercaseChars", "path": "test.py", "severity": "error", } assert issue.as_dict() == { "analyzer": "mock-lint-flake8", "check": "dummy rule", "column": 1, "in_patch": False, "level": "error", "line": 1, "message": "dummy test withUppercaseChars", "nb_lines": 1, "path": "test.py", "publishable": True, "validates": True, "hash": "34c27d119c21ea5a2cd3f6ac230d8c4e", }