| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -35,6 +35,8 @@ | |||
| 35 | 35 | "ProjectPipelineScheduleManager", | |
| 36 | 36 | "ProjectPipelineTestReport", | |
| 37 | 37 | "ProjectPipelineTestReportManager", | |
| 38 | + "ProjectPipelineTestReportSummary", | ||
| 39 | + "ProjectPipelineTestReportSummaryManager", | ||
| 38 | 40 | ] | |
| 39 | 41 | ||
| 40 | 42 | ||
@@ -52,6 +54,7 @@ class ProjectPipeline(RefreshMixin, ObjectDeleteMixin, RESTObject): | |||
| 52 | 54 | bridges: "ProjectPipelineBridgeManager" | |
| 53 | 55 | jobs: "ProjectPipelineJobManager" | |
| 54 | 56 | test_report: "ProjectPipelineTestReportManager" | |
| 57 | + test_report_summary: "ProjectPipelineTestReportSummaryManager" | ||
| 55 | 58 | variables: "ProjectPipelineVariableManager" | |
| 56 | 59 | ||
| 57 | 60 | @cli.register_custom_action("ProjectPipeline") | |
@@ -251,3 +254,20 @@ def get( | |||
| 251 | 254 | self, id: Optional[Union[int, str]] = None, **kwargs: Any | |
| 252 | 255 | ) -> Optional[ProjectPipelineTestReport]: | |
| 253 | 256 | return cast(Optional[ProjectPipelineTestReport], super().get(id=id, **kwargs)) | |
| 257 | + | ||
| 258 | + | ||
| 259 | + class ProjectPipelineTestReportSummary(RESTObject): | ||
| 260 | + _id_attr = None | ||
| 261 | + | ||
| 262 | + | ||
| 263 | + class ProjectPipelineTestReportSummaryManager(GetWithoutIdMixin, RESTManager): | ||
| 264 | + _path = "/projects/{project_id}/pipelines/{pipeline_id}/test_report_summary" | ||
| 265 | + _obj_cls = ProjectPipelineTestReportSummary | ||
| 266 | + _from_parent_attrs = {"project_id": "project_id", "pipeline_id": "id"} | ||
| 267 | + | ||
| 268 | + def get( | ||
| 269 | + self, id: Optional[Union[int, str]] = None, **kwargs: Any | ||
| 270 | + ) -> Optional[ProjectPipelineTestReportSummary]: | ||
| 271 | + return cast( | ||
| 272 | + Optional[ProjectPipelineTestReportSummary], super().get(id=id, **kwargs) | ||
| 273 | + ) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,7 +4,11 @@ | |||
| 4 | 4 | import pytest | |
| 5 | 5 | import responses | |
| 6 | 6 | ||
| 7 | - from gitlab.v4.objects import ProjectPipeline, ProjectPipelineTestReport | ||
| 7 | + from gitlab.v4.objects import ( | ||
| 8 | + ProjectPipeline, | ||
| 9 | + ProjectPipelineTestReport, | ||
| 10 | + ProjectPipelineTestReportSummary, | ||
| 11 | + ) | ||
| 8 | 12 | ||
| 9 | 13 | pipeline_content = { | |
| 10 | 14 | "id": 46, | |
@@ -66,6 +70,32 @@ | |||
| 66 | 70 | } | |
| 67 | 71 | ||
| 68 | 72 | ||
| 73 | + test_report_summary_content = { | ||
| 74 | + "total": { | ||
| 75 | + "time": 1904, | ||
| 76 | + "count": 3363, | ||
| 77 | + "success": 3351, | ||
| 78 | + "failed": 0, | ||
| 79 | + "skipped": 12, | ||
| 80 | + "error": 0, | ||
| 81 | + "suite_error": None, | ||
| 82 | + }, | ||
| 83 | + "test_suites": [ | ||
| 84 | + { | ||
| 85 | + "name": "test", | ||
| 86 | + "total_time": 1904, | ||
| 87 | + "total_count": 3363, | ||
| 88 | + "success_count": 3351, | ||
| 89 | + "failed_count": 0, | ||
| 90 | + "skipped_count": 12, | ||
| 91 | + "error_count": 0, | ||
| 92 | + "build_ids": [66004], | ||
| 93 | + "suite_error": None, | ||
| 94 | + } | ||
| 95 | + ], | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + | ||
| 69 | 99 | @pytest.fixture | |
| 70 | 100 | def resp_get_pipeline(): | |
| 71 | 101 | with responses.RequestsMock() as rsps: | |
@@ -118,6 +148,19 @@ def resp_get_pipeline_test_report(): | |||
| 118 | 148 | yield rsps | |
| 119 | 149 | ||
| 120 | 150 | ||
| 151 | + @pytest.fixture | ||
| 152 | + def resp_get_pipeline_test_report_summary(): | ||
| 153 | + with responses.RequestsMock() as rsps: | ||
| 154 | + rsps.add( | ||
| 155 | + method=responses.GET, | ||
| 156 | + url="http://localhost/api/v4/projects/1/pipelines/1/test_report_summary", | ||
| 157 | + json=test_report_summary_content, | ||
| 158 | + content_type="application/json", | ||
| 159 | + status=200, | ||
| 160 | + ) | ||
| 161 | + yield rsps | ||
| 162 | + | ||
| 163 | + | ||
| 121 | 164 | def test_get_project_pipeline(project, resp_get_pipeline): | |
| 122 | 165 | pipeline = project.pipelines.get(1) | |
| 123 | 166 | assert isinstance(pipeline, ProjectPipeline) | |
@@ -144,3 +187,13 @@ def test_get_project_pipeline_test_report(project, resp_get_pipeline_test_report | |||
| 144 | 187 | assert isinstance(test_report, ProjectPipelineTestReport) | |
| 145 | 188 | assert test_report.total_time == 5 | |
| 146 | 189 | assert test_report.test_suites[0]["name"] == "Secure" | |
| 190 | + | ||
| 191 | + | ||
| 192 | + def test_get_project_pipeline_test_report_summary( | ||
| 193 | + project, resp_get_pipeline_test_report_summary | ||
| 194 | + ): | ||
| 195 | + pipeline = project.pipelines.get(1, lazy=True) | ||
| 196 | + test_report_summary = pipeline.test_report_summary.get() | ||
| 197 | + assert isinstance(test_report_summary, ProjectPipelineTestReportSummary) | ||
| 198 | + assert test_report_summary.total["count"] == 3363 | ||
| 199 | + assert test_report_summary.test_suites[0]["name"] == "test" | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments