Mercurial > repos > bcclaywell > argo_navis
comparison venv/lib/python2.7/site-packages/github/tests/Authorization.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 | |
28 import datetime | |
29 | |
30 | |
31 class Authorization(Framework.TestCase): | |
32 def setUp(self): | |
33 Framework.TestCase.setUp(self) | |
34 self.authorization = self.g.get_user().get_authorization(372259) | |
35 | |
36 def testAttributes(self): | |
37 self.assertEqual(self.authorization.app.url, "http://developer.github.com/v3/oauth/#oauth-authorizations-api") | |
38 self.assertEqual(self.authorization.app.name, "GitHub API") | |
39 self.assertEqual(self.authorization.created_at, datetime.datetime(2012, 5, 22, 18, 3, 17)) | |
40 self.assertEqual(self.authorization.id, 372259) | |
41 self.assertEqual(self.authorization.note, None) | |
42 self.assertEqual(self.authorization.note_url, None) | |
43 self.assertEqual(self.authorization.scopes, []) | |
44 self.assertEqual(self.authorization.token, "82459c4500086f8f0cc67d2936c17d1e27ad1c33") | |
45 self.assertEqual(self.authorization.updated_at, datetime.datetime(2012, 5, 22, 18, 3, 17)) | |
46 self.assertEqual(self.authorization.url, "https://api.github.com/authorizations/372259") | |
47 | |
48 def testEdit(self): | |
49 self.authorization.edit() | |
50 self.assertEqual(self.authorization.scopes, []) | |
51 self.authorization.edit(scopes=["user"]) | |
52 self.assertEqual(self.authorization.scopes, ["user"]) | |
53 self.authorization.edit(add_scopes=["repo"]) | |
54 self.assertEqual(self.authorization.scopes, ["user", "repo"]) | |
55 self.authorization.edit(remove_scopes=["repo"]) | |
56 self.assertEqual(self.authorization.scopes, ["user"]) | |
57 self.assertEqual(self.authorization.note, None) | |
58 self.assertEqual(self.authorization.note_url, None) | |
59 self.authorization.edit(note="Note created by PyGithub", note_url="http://vincent-jacques.net/PyGithub") | |
60 self.assertEqual(self.authorization.note, "Note created by PyGithub") | |
61 self.assertEqual(self.authorization.note_url, "http://vincent-jacques.net/PyGithub") | |
62 | |
63 def testDelete(self): | |
64 self.authorization.delete() |