comparison venv/lib/python2.7/site-packages/github/tests/RawData.py @ 0:d67268158946 draft

planemo upload commit a3f181f5f126803c654b3a66dd4e83a48f7e203b
author bcclaywell
date Mon, 12 Oct 2015 17:43:33 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:d67268158946
1 # -*- coding: utf-8 -*-
2
3 # ########################## Copyrights and license ############################
4 # #
5 # Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
6 # #
7 # This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
8 # #
9 # PyGithub is free software: you can redistribute it and/or modify it under #
10 # the terms of the GNU Lesser General Public License as published by the Free #
11 # Software Foundation, either version 3 of the License, or (at your option) #
12 # any later version. #
13 # #
14 # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
15 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
16 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
17 # details. #
18 # #
19 # You should have received a copy of the GNU Lesser General Public License #
20 # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
21 # #
22 # ##############################################################################
23
24 import Framework
25
26 import github.NamedUser
27
28
29 class RawData(Framework.TestCase):
30 jacquev6RawData = {
31 'disk_usage': 13812,
32 'private_gists': 5,
33 'public_repos': 21,
34 'subscriptions_url': 'https://api.github.com/users/jacquev6/subscriptions',
35 'gravatar_id': 'b68de5ae38616c296fa345d2b9df2225',
36 'hireable': False,
37 'id': 327146,
38 'followers_url': 'https://api.github.com/users/jacquev6/followers',
39 'following_url': 'https://api.github.com/users/jacquev6/following',
40 'collaborators': 1,
41 'total_private_repos': 4,
42 'blog': 'http://vincent-jacques.net',
43 'followers': 22,
44 'location': 'Paris, France',
45 'type': 'User',
46 'email': 'vincent@vincent-jacques.net',
47 'bio': '',
48 'gists_url': 'https://api.github.com/users/jacquev6/gists{/gist_id}',
49 'owned_private_repos': 4,
50 'company': 'Criteo',
51 'events_url': 'https://api.github.com/users/jacquev6/events{/privacy}',
52 'html_url': 'https://github.com/jacquev6',
53 'updated_at': '2013-03-12T22:13:32Z',
54 'plan': {
55 'collaborators': 1,
56 'name': 'micro',
57 'private_repos': 5,
58 'space': 614400,
59 },
60 'received_events_url': 'https://api.github.com/users/jacquev6/received_events',
61 'starred_url': 'https://api.github.com/users/jacquev6/starred{/owner}{/repo}',
62 'public_gists': 2,
63 'name': 'Vincent Jacques',
64 'organizations_url': 'https://api.github.com/users/jacquev6/orgs',
65 'url': 'https://api.github.com/users/jacquev6',
66 'created_at': '2010-07-09T06:10:06Z',
67 'avatar_url': 'https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png',
68 'repos_url': 'https://api.github.com/users/jacquev6/repos',
69 'following': 38,
70 'login': 'jacquev6',
71 }
72
73 planRawData = {
74 'collaborators': 1,
75 'name': 'micro',
76 'private_repos': 5,
77 'space': 614400,
78 }
79
80 def testCompletedObject(self):
81 user = self.g.get_user("jacquev6")
82 self.assertTrue(user._CompletableGithubObject__completed)
83 self.assertEqual(user.raw_data, RawData.jacquev6RawData)
84
85 def testNotYetCompletedObject(self):
86 user = self.g.get_user().get_repo("PyGithub").owner
87 self.assertFalse(user._CompletableGithubObject__completed)
88 self.assertEqual(user.raw_data, RawData.jacquev6RawData)
89 self.assertTrue(user._CompletableGithubObject__completed)
90
91 def testNonCompletableObject(self):
92 plan = self.g.get_user().plan
93 self.assertEqual(plan.raw_data, RawData.planRawData)
94
95 def testCreateObjectFromRawData(self):
96 user = self.g.create_from_raw_data(github.NamedUser.NamedUser, RawData.jacquev6RawData)
97 self.assertEqual(user._CompletableGithubObject__completed, True)
98 self.assertEqual(user.name, "Vincent Jacques")