aboutsummaryrefslogtreecommitdiffstats
path: root/pygithub3
diff options
context:
space:
mode:
authorAlejandro Gómez <alejandroogomez@gmail.com>2012-05-17 22:41:59 +0200
committerAlejandro Gómez <alejandroogomez@gmail.com>2012-05-27 19:54:29 +0200
commita83b53bbb807aa01b490ca56e186e69e4befc08c (patch)
treefab5edc774b8d2abe0e35b24071a959d1252773e /pygithub3
parentadd build/ to .gitignore (diff)
downloadpython-github3-a83b53bbb807aa01b490ca56e186e69e4befc08c.tar.xz
python-github3-a83b53bbb807aa01b490ca56e186e69e4befc08c.zip
add Pull Request to `Issue` resources
Diffstat (limited to 'pygithub3')
-rw-r--r--pygithub3/resources/issues.py14
-rw-r--r--pygithub3/tests/resources/test_issues.py2
2 files changed, 13 insertions, 3 deletions
diff --git a/pygithub3/resources/issues.py b/pygithub3/resources/issues.py
index af7547f..69f905a 100644
--- a/pygithub3/resources/issues.py
+++ b/pygithub3/resources/issues.py
@@ -5,9 +5,11 @@ import re
from .base import Resource
from .users import User
+from .pull_requests import PullRequest
class Label(Resource):
+
@staticmethod
def is_valid_color(color):
valid_color = re.compile(r'[0-9abcdefABCDEF]{6}')
@@ -21,6 +23,7 @@ class Label(Resource):
class Milestone(Resource):
+
_dates = ('created_at', 'due_on')
_maps = {'creator': User}
@@ -30,8 +33,15 @@ class Milestone(Resource):
class Issue(Resource):
- _dates = ('created_at', 'updated_at')
- _maps = {'assignee': User, 'user': User}
+ _dates = ('created_at', 'updated_at', 'closed_at')
+ _maps = {
+ 'assignee': User,
+ 'user': User,
+ 'milestone': Milestone,
+ 'pull_request': PullRequest
+ }
+
+ _collection_maps = {'labels': Label}
def __str__(self):
return '<Issue (%s)>' % getattr(self, 'number', '')
diff --git a/pygithub3/tests/resources/test_issues.py b/pygithub3/tests/resources/test_issues.py
index 0bef3c1..ae572af 100644
--- a/pygithub3/tests/resources/test_issues.py
+++ b/pygithub3/tests/resources/test_issues.py
@@ -8,7 +8,7 @@ from pygithub3.resources.issues import Label
class TestLabel(TestCase):
def test_is_valid_color(self):
- valid_colors = ['BADA55', 'FFFFFF', '45DFCA']
+ valid_colors = ['BADa55', 'FF42FF', '45DFCA']
for color in valid_colors:
self.assertTrue(Label.is_valid_color(color))