Mercurial > repos > bcclaywell > argo_navis
comparison venv/lib/python2.7/site-packages/github/tests/Authentication.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 2012 Vincent Jacques <vincent@vincent-jacques.net> # | |
6 # Copyright 2012 Zearin <zearin@gonk.net> # | |
7 # Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> # | |
8 # # | |
9 # This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ # | |
10 # # | |
11 # PyGithub is free software: you can redistribute it and/or modify it under # | |
12 # the terms of the GNU Lesser General Public License as published by the Free # | |
13 # Software Foundation, either version 3 of the License, or (at your option) # | |
14 # any later version. # | |
15 # # | |
16 # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY # | |
17 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # | |
18 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # | |
19 # details. # | |
20 # # | |
21 # You should have received a copy of the GNU Lesser General Public License # | |
22 # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. # | |
23 # # | |
24 # ############################################################################## | |
25 | |
26 import Framework | |
27 import github | |
28 | |
29 | |
30 class Authentication(Framework.BasicTestCase): | |
31 def testNoAuthentication(self): | |
32 g = github.Github() | |
33 self.assertEqual(g.get_user("jacquev6").name, "Vincent Jacques") | |
34 | |
35 def testBasicAuthentication(self): | |
36 g = github.Github(self.login, self.password) | |
37 self.assertEqual(g.get_user("jacquev6").name, "Vincent Jacques") | |
38 | |
39 def testOAuthAuthentication(self): | |
40 g = github.Github(self.oauth_token) | |
41 self.assertEqual(g.get_user("jacquev6").name, "Vincent Jacques") | |
42 | |
43 # Warning: I don't have a scret key, so the requests for this test are forged | |
44 def testSecretKeyAuthentication(self): | |
45 g = github.Github(client_id=self.client_id, client_secret=self.client_secret) | |
46 self.assertListKeyEqual(g.get_organization("BeaverSoftware").get_repos("public"), lambda r: r.name, ["FatherBeaver", "PyGithub"]) | |
47 | |
48 def testUserAgent(self): | |
49 g = github.Github(user_agent="PyGithubTester") | |
50 self.assertEqual(g.get_user("jacquev6").name, "Vincent Jacques") | |
51 | |
52 def testAuthorizationHeaderWithLogin(self): | |
53 # See special case in Framework.fixAuthorizationHeader | |
54 g = github.Github("fake_login", "fake_password") | |
55 try: | |
56 g.get_user().name | |
57 except github.GithubException: | |
58 pass | |
59 | |
60 def testAuthorizationHeaderWithToken(self): | |
61 # See special case in Framework.fixAuthorizationHeader | |
62 g = github.Github("ZmFrZV9sb2dpbjpmYWtlX3Bhc3N3b3Jk") | |
63 try: | |
64 g.get_user().name | |
65 except github.GithubException: | |
66 pass |