-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add option to return jira issue metadata (#108)
- Loading branch information
1 parent
8123759
commit 722d663
Showing
5 changed files
with
145 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
from marshmallow import Schema, fields, EXCLUDE | ||
|
||
|
||
class Basic(Schema): | ||
id = fields.String() | ||
name = fields.String() | ||
|
||
|
||
class Components(Schema): | ||
name = fields.String() | ||
|
||
|
||
class Version(Schema): | ||
name = fields.String() | ||
|
||
|
||
class Priority(Basic): | ||
pass | ||
|
||
|
||
class Resolution(Basic): | ||
description = fields.String() | ||
|
||
|
||
class Status(Basic): | ||
description = fields.String() | ||
|
||
|
||
class Type(Basic): | ||
subtask = fields.Boolean() | ||
|
||
|
||
class User(Schema): | ||
key = fields.String() | ||
name = fields.String() | ||
displayName = fields.String() | ||
active = fields.Boolean() | ||
|
||
|
||
class JiraIssueSchema(Schema): | ||
class Meta: | ||
unknown = EXCLUDE # exclude unknown fields | ||
# Default set to None for fields that are not filled | ||
issuetype = fields.Nested(Type(), default=None) | ||
status = fields.Nested(Status(), default=None) | ||
priority = fields.Nested(Priority(), default=None) | ||
reporter = fields.Nested(User(), default=None) | ||
creator = fields.Nested(User(), default=None) | ||
versions = fields.List(fields.Nested(Version()), default=None) | ||
summary = fields.String(default=None) | ||
updated = fields.String(default=None) | ||
created = fields.String(default=None) | ||
resolutiondate = fields.String(default=None) | ||
duedate = fields.String(default=None) | ||
fixVersions = fields.List(fields.Nested(Version()), default=None) | ||
components = fields.List(fields.Nested(Components()), default=None) | ||
resolution = fields.Nested(Resolution(), default=None) | ||
assignee = fields.Nested(User(), default=None) | ||
labels = fields.List(fields.String()) | ||
|
||
|
||
class JiraIssue: | ||
def __init__(self, issue_id, **entries): | ||
self.__dict__.update(entries) | ||
self.issue_id = issue_id | ||
|
||
def __repr__(self): | ||
return 'JiraIssue {}'.format(self.issue_id) | ||
|
||
@property | ||
def components_list(self): | ||
return set(component['name'] for component in self.components) | ||
|
||
@property | ||
def fixed_versions(self): | ||
return set(version['name'] for version in self.fix_versions) | ||
|
||
@property | ||
def versions_list(self): | ||
return set(version['name'] for version in self.versions) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ pytest>=2.2.4 | |
six | ||
requests>=2.13.0 | ||
retry>=0.9.2 | ||
marshmallow>=3.2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters