Skip to content

Commit 6c3842f

Browse files
authored
Request/Response object models
1 parent 510119c commit 6c3842f

File tree

13 files changed

+979
-18
lines changed

13 files changed

+979
-18
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ repos:
88
- id: end-of-file-fixer
99
- id: check-yaml
1010
- id: check-added-large-files
11-
- id: flake8
1211
- repo: https://github.com/PyCQA/pydocstyle
1312
rev: 5.0.2
1413
hooks:
@@ -17,3 +16,7 @@ repos:
1716
rev: v1.0.0
1817
hooks:
1918
- id: rst-linter
19+
- repo: https://gitlab.com/pycqa/flake8.git
20+
rev: 3.7.7
21+
hooks:
22+
- id: flake8

reportportal_client/core/rp_file.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""This module contains classes representing RP file object."""
2+
3+
4+
class RPFile(object):
5+
"""Class representation for a file that will be attached to the log."""
6+
7+
def __init__(self,
8+
name=None,
9+
content=None,
10+
content_type=None):
11+
"""Initialize instance attributes.
12+
13+
:param name: File name
14+
:param content: File content
15+
:param content_type: File content type (i.e. application/pdf)
16+
"""
17+
self.content = content
18+
self.content_type = content_type
19+
self.name = name
20+
21+
@property
22+
def payload(self):
23+
"""Get HTTP payload for the request."""
24+
return {
25+
'content': self.content,
26+
'contentType': self.content_type,
27+
'name': self.name
28+
}

reportportal_client/core/rp_file.pyi

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from typing import Any, Dict, Optional, Text
2+
3+
class RPFile:
4+
content: Any = ...
5+
content_type: Text = ...
6+
name: Text = ...
7+
def __init__(self,
8+
name: Optional[Text],
9+
content: Any,
10+
content_type: Optional[Text]) -> None: ...
11+
@property
12+
def payload(self) -> Dict: ...

reportportal_client/core/rp_issues.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,20 @@
2424
}
2525
...
2626
}
27+
28+
Copyright (c) 2018 http://reportportal.io .
29+
30+
Licensed under the Apache License, Version 2.0 (the "License");
31+
you may not use this file except in compliance with the License.
32+
You may obtain a copy of the License at
33+
34+
http://www.apache.org/licenses/LICENSE-2.0
35+
36+
Unless required by applicable law or agreed to in writing, software
37+
distributed under the License is distributed on an "AS IS" BASIS,
38+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
39+
See the License for the specific language governing permissions and
40+
limitations under the License.
2741
"""
2842

2943

@@ -37,8 +51,9 @@ def __init__(self,
3751
ignore_analyzer=True):
3852
"""Initialize instance attributes.
3953
40-
:param issue_type: Type of the issue. One of the followings:
41-
NOT_ISSUE, ab001, pb001, si001, nd001, ti001
54+
:param issue_type: Issue type locator. Allowable values: "pb***",
55+
"ab***", "si***", "ti***", "nd001". Where ***
56+
is locator id.
4257
:param comment: Issue comments
4358
:param auto_analyzed: Indicator that the issue has been marked with
4459
the RP auto analyzer
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
from typing import Dict, List, Optional
1+
from typing import Dict, List, Optional, Text
22

33
class Issue:
44
_external_issues: List = ...
55
auto_analyzed: bool = ...
6-
comment: str = ...
6+
comment: Text = ...
77
ignore_analyzer: bool = ...
8-
issue_type: str = ...
8+
issue_type: Text = ...
99
def __init__(self,
10-
issue_type: str,
11-
comment: Optional[str] = ...,
10+
issue_type: Text,
11+
comment: Optional[Text] = ...,
1212
auto_analyzed: Optional[bool] = ...,
1313
ignore_analyzer: Optional[bool] = ...) -> None: ...
1414
def external_issue_add(self, issue: ExternalIssue) -> None: ...
1515
@property
1616
def payload(self) -> Dict: ...
1717

1818
class ExternalIssue:
19-
bts_url: str = ...
20-
bts_project: str = ...
21-
submit_date: str = ...
22-
ticket_id: str = ...
23-
url: str = ...
19+
bts_url: Text = ...
20+
bts_project: Text = ...
21+
submit_date: Text = ...
22+
ticket_id: Text = ...
23+
url: Text = ...
2424
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: ...
25+
bts_url: Optional[Text] = ...,
26+
bts_project: Optional[Text] = ...,
27+
submit_date: Optional[Text] = ...,
28+
ticket_id: Optional[Text] = ...,
29+
url: Optional[Text] = ...) -> None: ...
3030
@property
3131
def payload(self) -> Dict: ...

0 commit comments

Comments
 (0)