8000 Added additional attributes to Licenses · pythonthings/github3.py@7f41fca · GitHub
[go: up one dir, main page]

Skip to content

Commit 7f41fca

Browse files
Added additional attributes to Licenses
Updated unit test for license to make sure attributes exist Removed empty whiteline in repo.py
1 parent 9858d47 commit 7f41fca

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

github3/licenses.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,23 @@ def _update_attributes(self, license):
3434
# featured
3535
self.featured = license.get('featured')
3636

37+
# html url
38+
self.html_url = license.get('html_url')
39+
40+
# body
41+
self.body = license.get('body')
42+
43+
# key
44+
self.key = license.get('key')
45+
46+
# description
47+
self.description = license.get('description')
48+
49+
# implementation
50+
self.implementation = license.get('implementation')
51+
52+
# required
53+
self.required = license.get('required')
54+
3755
def _repr(self):
3856
return '<License [{0}]>'.format(self.name)

github3/repos/repo.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ def _update_attributes(self, repo):
108108
self.id = repo.get('id', 0)
109109
#: Language property.
110110
self.language = repo.get('language', '')
111-
112111
#: Mirror property.
113112
self.mirror_url = repo.get('mirror_url', '')
114113

tests/unit/test_licenses.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,24 @@ class TestLicenses(UnitHelper):
1414
described_class = github3.licenses.License
1515
example_data = get_example_data()
1616

17+
def test_get_attr(self):
18+
"""Show that attributes exist in class."""
19+
attributes = [
20+
'description',
21+
'body',
22+
'implementation',
23+
'html_url',
24+
'key',
25+
'required',
26+
'name',
27+
'permitted',
28+
'category',
29+
'forbidden',
30+
'featured',
31+
]
32+
for attr in attributes:
33+
assert(getattr(self.instance, attr))
34+
1735
def test_repr(self):
1836
"""Show that instance string is formatted properly."""
1937
assert(repr(self.instance).startswith('<License'))

0 commit comments

Comments
 (0)
0