Add initial version of getemojis

This commit is contained in:
Steve Brown
2013-12-01 23:19:58 +00:00
parent 3ff7e4843e
commit 282278d19c
3 changed files with 26 additions and 0 deletions
+11
View File
@@ -359,6 +359,17 @@ class Github(object):
)
return GitignoreTemplate.GitignoreTemplate(self.__requester, headers, attributes, completed=True)
def get_emojis(self):
"""
:calls: `GET /emojis <http://developer.github.com/v3/emojis/>`_
:rtype: dictionary of type => url for emoji`
"""
headers, attributes = self.__requester.requestJsonAndCheck(
"GET",
"/emojis"
)
return attributes
def create_from_raw_data(self, klass, raw_data, headers={}):
"""
Creates an object from raw_data previously obtained by :attr:`github.GithubObject.GithubObject.raw_data`,
+5
View File
@@ -105,6 +105,11 @@ class Github(Framework.TestCase):
self.assertEqual(hook.events, ["push"])
self.assertEqual(hook.schema, [["string", "url"], ["string", "token"], ["string", "project_id"], ["string", "milestone_id"], ["string", "category_id"]])
def testGetEmojis(self):
emojis = self.g.get_emojis()
first = emojis.get("+1")
self.assertEqual(first, "https://github.global.ssl.fastly.net/images/icons/emoji/+1.png?v5")
def testGetHook(self):
hook = self.g.get_hook("activecollab")
self.assertEqual(hook.name, "activecollab")
@@ -0,0 +1,10 @@
https
GET
api.github.com
None
/emojis
{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
null
200
[('status', '200 OK'), ('content-length', '757'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('x-ratelimit-limit', '5000'), ('x-ratelimit-remaining', '4993'), ('server', 'nginx'), ('connection', 'keep-alive'), ('etag', '"cc8e8df5d003cd489fd90931fa7f751a"'), ('cache-control', 'max-age=0, private, must-revalidate'), ('date', 'Fri, 21 Dec 2012 19:54:21 GMT'), ('content-type', 'application/json; charset=utf-8')]
{"+1": "https://github.global.ssl.fastly.net/images/icons/emoji/+1.png?v5", "-1": "https://github.global.ssl.fastly.net/images/icons/emoji/-1.png?v5", "100": "https://github.global.ssl.fastly.net/images/icons/emoji/100.png?v5", "1234": "https://github.global.ssl.fastly.net/images/icons/emoji/1234.png?v5", "8ball": "https://github.global.ssl.fastly.net/images/icons/emoji/8ball.png?v5", "a": "https://github.global.ssl.fastly.net/images/icons/emoji/a.png?v5", "ab": "https://github.global.ssl.fastly.net/images/icons/emoji/ab.png?v5"}