forked from dustin/py-github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithubtest.py
More file actions
executable file
·48 lines (39 loc) · 1.54 KB
/
githubtest.py
File metadata and controls
executable file
·48 lines (39 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python
"""
Copyright (c) 2007 Dustin Sallings <dustin@spy.net>
"""
import unittest
import github
class GitHubTest(unittest.TestCase):
def __gh(self, expUrl, filename):
def opener(url):
self.assertEquals(expUrl, url)
return open(filename)
return github.GitHub(opener)
def __loadUser(self):
return self.__gh('http://github.com/api/v1/xml/dustin',
'data/user.xml').user('dustin')
def testUserBase(self):
"""Test the base properties of the user object."""
u=self.__loadUser()
self.assertEquals("Dustin Sallings", u.name)
self.assertEquals("dustin", u.login)
self.assertEquals("dustin@spy.net", u.email)
self.assertEquals("Santa Clara, CA", u.location)
self.assertEquals("<<User dustin with 19 repos>>", repr(u))
def testUserRepos(self):
"""Test the repositories within the user object."""
u=self.__loadUser()
self.assertEquals(19, len(u.repos))
self.assertEquals('buildwatch', u.repos['buildwatch'].name)
self.assertEquals('http://github.com/dustin/buildwatch',
u.repos['buildwatch'].url)
self.assertEquals('A buildbot GUI for OS X',
u.repos['buildwatch'].description)
self.assertEquals('http://code.google.com/p/buildwatch/',
u.repos['buildwatch'].homepage)
self.assertEquals("<<Repository buildwatch>>",
repr(u.repos['buildwatch']))
if __name__ == '__main__':
unittest.main()
# gh=github.GitHub(hack)