comparison venv/lib/python2.7/site-packages/github/tests/Enterprise.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 github
27
28 import Framework
29
30
31 # Replay data for this test case is forged, because I don't have access to a real Github Enterprise install
32 class Enterprise(Framework.BasicTestCase):
33 def testHttps(self):
34 g = github.Github(self.login, self.password, base_url="https://my.enterprise.com")
35 self.assertListKeyEqual(g.get_user().get_repos(), lambda r: r.name, ["TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "Hacking", "vincent-jacques.net", "Contests", "Candidates", "Tests", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE"])
36
37 def testHttp(self):
38 g = github.Github(self.login, self.password, base_url="http://my.enterprise.com")
39 self.assertListKeyEqual(g.get_user().get_repos(), lambda r: r.name, ["TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "Hacking", "vincent-jacques.net", "Contests", "Candidates", "Tests", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE"])
40
41 def testUnknownUrlScheme(self): # To stay compatible with Python 2.6, we do not use self.assertRaises with only one argument
42 try:
43 github.Github(self.login, self.password, base_url="foobar://my.enterprise.com")
44 except AssertionError, exception:
45 raised = True
46 self.assertEqual(exception.args[0], "Unknown URL scheme")
47 self.assertTrue(raised)
48
49 def testLongUrl(self):
50 g = github.Github(self.login, self.password, base_url="http://my.enterprise.com/path/to/github")
51 repos = g.get_user().get_repos()
52 self.assertListKeyEqual(repos, lambda r: r.name, ["TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "Hacking", "vincent-jacques.net", "Contests", "Candidates", "Tests", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE"])
53 self.assertEqual(repos[0].owner.name, "Vincent Jacques")
54
55 def testSpecificPort(self):
56 g = github.Github(self.login, self.password, base_url="http://my.enterprise.com:8080")
57 self.assertListKeyEqual(g.get_user().get_repos(), lambda r: r.name, ["TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "Hacking", "vincent-jacques.net", "Contests", "Candidates", "Tests", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE"])