16 with pytest.raises(ValueError):
23 report = RB.generateReport()
26 ==
'{"_class": "io.jenkins.plugins.analysis.core.restapi.ReportApi", "issues": [], "size": 0}'
32 RB.addIssue(
"some/file/path.py",
"LOW",
"test")
33 report = RB.generateReport()
36 ==
'{"_class": "io.jenkins.plugins.analysis.core.restapi.ReportApi", "issues": [{"fileName": "some/file/path.py", "directory": "some/file/", "severity": "LOW", "message": "test"}], "size": 1}'
41 with pytest.raises(Exception):
43 RB.addIssue(
"/some/file/path/",
"LOW",
"test")
44 report = RB.generateReport()
48 with pytest.raises(Exception):
50 RB.addIssue(
None,
"LOW",
"test")
51 report = RB.generateReport()
55 with pytest.raises(Exception):
57 RB.addIssue(
"",
"LOW",
"test")
58 report = RB.generateReport()
62 with pytest.raises(Exception):
64 RB.addIssue(
"a.txt",
"severityunk",
"test")
65 report = RB.generateReport()
69 with pytest.raises(Exception):
71 RB.addIssue(
"a.txt",
"LOW",
None)
72 report = RB.generateReport()
76 with pytest.raises(Exception):
78 RB.addIssue(
"a.txt",
"LOW",
"")
79 report = RB.generateReport()
84 RB.addIssue(
"some/file/path.py",
"LOW",
"test", lineStart=1)
85 report = RB.generateReport()
88 ==
'{"_class": "io.jenkins.plugins.analysis.core.restapi.ReportApi", "issues": [{"fileName": "some/file/path.py", "directory": "some/file/", "severity": "LOW", "message": "test", "lineStart": 1}], "size": 1}'
94 RB.addIssue(
"some/file/path.py",
"LOW",
"test", lineStart=1, lineEnd=2)
95 report = RB.generateReport()
98 ==
'{"_class": "io.jenkins.plugins.analysis.core.restapi.ReportApi", "issues": [{"fileName": "some/file/path.py", "directory": "some/file/", "severity": "LOW", "message": "test", "lineStart": 1, "lineEnd": 2}], "size": 1}'
104 RB.addIssue(
"some/file/path.py",
"LOW",
"test", lineEnd=2)
105 report = RB.generateReport()
108 ==
'{"_class": "io.jenkins.plugins.analysis.core.restapi.ReportApi", "issues": [{"fileName": "some/file/path.py", "directory": "some/file/", "severity": "LOW", "message": "test"}], "size": 1}'
115 "some/file/path.py",
"LOW",
"test", lineStart=1, lineEnd=2, columnStart=3
117 report = RB.generateReport()
120 ==
'{"_class": "io.jenkins.plugins.analysis.core.restapi.ReportApi", "issues": [{"fileName": "some/file/path.py", "directory": "some/file/", "severity": "LOW", "message": "test", "lineStart": 1, "lineEnd": 2, "columnStart": 3}], "size": 1}'
135 report = RB.generateReport()
138 ==
'{"_class": "io.jenkins.plugins.analysis.core.restapi.ReportApi", "issues": [{"fileName": "some/file/path.py", "directory": "some/file/", "severity": "LOW", "message": "test", "lineStart": 1, "lineEnd": 2, "columnStart": 3, "columnEnd": 4}], "size": 1}'
145 "some/file/path.py",
"LOW",
"test", lineStart=1, lineEnd=2, columnEnd=4
147 report = RB.generateReport()
150 ==
'{"_class": "io.jenkins.plugins.analysis.core.restapi.ReportApi", "issues": [{"fileName": "some/file/path.py", "directory": "some/file/", "severity": "LOW", "message": "test", "lineStart": 1, "lineEnd": 2}], "size": 1}'
166 report = RB.generateReport()
169 ==
'{"_class": "io.jenkins.plugins.analysis.core.restapi.ReportApi", "issues": [{"fileName": "some/file/path.py", "directory": "some/file/", "severity": "LOW", "message": "test", "lineStart": 1, "lineEnd": 2, "columnStart": 3, "columnEnd": 4, "category": "category"}], "size": 1}'
186 report = RB.generateReport()
189 ==
'{"_class": "io.jenkins.plugins.analysis.core.restapi.ReportApi", "issues": [{"fileName": "some/file/path.py", "directory": "some/file/", "severity": "LOW", "message": "test", "lineStart": 1, "lineEnd": 2, "columnStart": 3, "columnEnd": 4, "category": "category", "type": "type"}], "size": 1}'
205 description=
"description",
207 report = RB.generateReport()
210 ==
'{"_class": "io.jenkins.plugins.analysis.core.restapi.ReportApi", "issues": [{"fileName": "some/file/path.py", "directory": "some/file/", "severity": "LOW", "message": "test", "lineStart": 1, "lineEnd": 2, "columnStart": 3, "columnEnd": 4, "category": "category", "type": "type", "description": "description"}], "size": 1}'
226 description=
"description",
227 packageName=
"package",
229 report = RB.generateReport()
232 ==
'{"_class": "io.jenkins.plugins.analysis.core.restapi.ReportApi", "issues": [{"fileName": "some/file/path.py", "directory": "some/file/", "severity": "LOW", "message": "test", "lineStart": 1, "lineEnd": 2, "columnStart": 3, "columnEnd": 4, "category": "category", "type": "type", "description": "description", "packageName": "package"}], "size": 1}'
248 description=
"description",
249 packageName=
"package",
252 report = RB.generateReport()
255 ==
'{"_class": "io.jenkins.plugins.analysis.core.restapi.ReportApi", "issues": [{"fileName": "some/file/path.py", "directory": "some/file/", "severity": "LOW", "message": "test", "lineStart": 1, "lineEnd": 2, "columnStart": 3, "columnEnd": 4, "category": "category", "type": "type", "description": "description", "packageName": "package", "moduleName": "module"}], "size": 1}'
271 description=
"description",
272 packageName=
"package",
274 additionalProperties=
"adds",
276 report = RB.generateReport()
279 ==
'{"_class": "io.jenkins.plugins.analysis.core.restapi.ReportApi", "issues": [{"fileName": "some/file/path.py", "directory": "some/file/", "severity": "LOW", "message": "test", "lineStart": 1, "lineEnd": 2, "columnStart": 3, "columnEnd": 4, "category": "category", "type": "type", "description": "description", "packageName": "package", "moduleName": "module", "additionalProperties": "adds"}], "size": 1}'
283 if __name__ ==
"__main__":
def test_build_basic_report_empty_path_fails(self)
def test_build_basic_report_none_path_fails(self)
def test_build_basic_report_unknown_severity_fails(self)
def test_build_full_report_lineStartEnd_fails_noStart(self)
def test_build_full_report_lineStartEnd(self)
def test_build_full_report_lineStartEndcolStartEndCatgType(self)
def test_build_full_report_lineStartEndcolStartEndCatg(self)
def test_build_full_report_lineStartEndcolStartEndCatgTypeDescr(self)
def test_build_basic_report(self)
def test_build_full_report(self)
def test_build_full_report_lineStart(self)
def test_build_full_report_lineStartEndcolStartEndCatgTypeDescrPack(self)
def test_build_full_report_lineStartEndcolStartEnd_fails_noStart(self)
def test_build_empty_report(self)
def test_build_full_report_lineStartEndcolStartEndCatgTypeDescrPackMod(self)
def test_build_full_report_lineStartEndcolStart(self)
def test_build_basic_report_invalid_path_fails(self)
def test_build_full_report_lineStartEndcolStartEnd(self)
def test_build_basic_report_none_empty_message_fails(self)
def test_cannot_init_twice(self)
def test_build_basic_report_none_message_fails(self)
This module provides utlilities related to creating Jenkins' warnings-ng-plugin-compatible reports fr...