Skip to content

Commit 0e38959

Browse files
author
Dmitriy Gumeniuk
authored
Merge pull request #99 from iivanou/rp_issues
Report portal issues.
2 parents fe78a2e + f0ce0de commit 0e38959

File tree

3 files changed

+134
-0
lines changed

3 files changed

+134
-0
lines changed

reportportal_client/core/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""This package contains core reportportal-client modules."""

reportportal_client/core/rp_issues.py

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
"""This module includes classes representing RP issues.
2+
3+
Issues are reported within the test item result PUT call. One issue can be
4+
associated with multiple external issues. By external issues is meant issues
5+
at the existing bug tracker systems. The following keys need to be sent in
6+
order to add an issue to the test result:
7+
8+
{
9+
...,
10+
"issue": {
11+
"autoAnalyzed": true,
12+
"comment": "string",
13+
"externalSystemIssues": [
14+
{
15+
"btsProject": "string",
16+
"btsUrl": "string",
17+
"submitDate": 0,
18+
"ticketId": "string",
19+
"url": "string"
20+
}
21+
],
22+
"ignoreAnalyzer": true,
23+
"issueType": "string"
24+
}
25+
...
26+
}
27+
"""
28+
29+
30+
class Issue(object):
31+
"""This class represents an issue that can be attached to test result."""
32+
33+
def __init__(self,
34+
issue_type,
35+
comment=None,
36+
auto_analyzed=False,
37+
ignore_analyzer=True):
38+
"""Initialize instance attributes.
39+
40+
:param issue_type: Type of the issue. One of the followings:
41+
NOT_ISSUE, ab001, pb001, si001, nd001, ti001
42+
:param comment: Issue comments
43+
:param auto_analyzed: Indicator that the issue has been marked with
44+
the RP auto analyzer
45+
:param ignore_analyzer: Flag that forces RP analyzer to ignore this
46+
issue
47+
"""
48+
self._external_issues = []
49+
self.auto_analyzed = auto_analyzed
50+
self.comment = comment
51+
self.ignore_analyzer = ignore_analyzer
52+
self.issue_type = issue_type
53+
54+
def external_issue_add(self, issue):
55+
"""Add external system issue to the issue."""
56+
self._external_issues.append(issue.payload)
57+
58+
@property
59+
def payload(self):
60+
"""Form the correct dictionary for the issue."""
61+
return {
62+
'autoAnalyzed': self.auto_analyzed,
63+
'comment': self.comment,
64+
'externalSystemIssues': self._external_issues,
65+
'ignoreAnalyzer': self.ignore_analyzer,
66+
'issueType': self.issue_type
67+
}
68+
69+
70+
class ExternalIssue(object):
71+
"""This class represents external(BTS) system issue."""
72+
73+
def __init__(self,
74+
bts_url=None,
75+
bts_project=None,
76+
submit_date=None,
77+
ticket_id=None,
78+
url=None):
79+
"""Initialize instance attributes.
80+
81+
:param bts_url: Bug tracker system URL
82+
:param bts_project: Bug tracker system project
83+
:param submit_date: Bug submission date
84+
:param ticket_id: Unique ID of the ticket at the BTS
85+
:param url: URL to the ticket(bug)
86+
"""
87+
self.bts_url = bts_url
88+
self.bts_project = bts_project
89+
self.submit_date = submit_date
90+
self.ticket_id = ticket_id
91+
self.url = url
92+
93+
@property
94+
def payload(self):
95+
"""Form the correct dictionary for the BTS issue."""
96+
return {
97+
'brsUrl': self.bts_url,
98+
'btsProject': self.bts_project,
99+
'submitDate': self.submit_date,
100+
'ticketId': self.ticket_id,
101+
'url': self.url
102+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from typing import Dict, List, Optional
2+
3+
class Issue:
4+
_external_issues: List = ...
5+
auto_analyzed: bool = ...
6+
comment: str = ...
7+
ignore_analyzer: bool = ...
8+
issue_type: str = ...
9+
def __init__(self,
10+
issue_type: str,
11+
comment: Optional[str] = ...,
12+
auto_analyzed: Optional[bool] = ...,
13+
ignore_analyzer: Optional[bool] = ...) -> None: ...
14+
def external_issue_add(self, issue: ExternalIssue) -> None: ...
15+
@property
16+
def payload(self) -> Dict: ...
17+
18+
class ExternalIssue:
19+
bts_url: str = ...
20+
bts_project: str = ...
21+
submit_date: str = ...
22+
ticket_id: str = ...
23+
url: str = ...
24+
def __init__(self,
25+
bts_url: Optional[str] = ...,
26+
bts_project: Optional[str] = ...,
27+
submit_date: Optional[str] = ...,
28+
ticket_id: Optional[str] = ...,
29+
url: Optional[str] = ...) -> None: ...
30+
@property
31+
def payload(self) -> Dict: ...

0 commit comments

Comments
 (0)