diff --git a/codegen/templates/GithubObject.Implementation.py b/codegen/templates/GithubObject.Implementation.py
index 1dc549e5..1c5a653c 100644
--- a/codegen/templates/GithubObject.Implementation.py
+++ b/codegen/templates/GithubObject.Implementation.py
@@ -11,13 +11,13 @@
def _useAttributes( self, attributes ):
{% for attribute in class.attributes|dictsort:"name" %}
-
+
{% with simple_or_complex=attribute.type.simple|yesno:"simple,complex_as_dict" %}
if "{{ attribute.name }}" in attributes: # pragma no branch
{% with template_name="GithubObject.IsInstance."|add:attribute.type.cardinality|add:"."|add:simple_or_complex|add:".py" %}
assert attributes[ "{{ attribute.name }}" ] is None or {% include template_name with variable="attributes[ \""|add:attribute.name|add:"\" ]"|safe type=attribute.type only %}, attributes[ "{{ attribute.name }}" ]
{% endwith %}
- {% endwith %}
+ {% endwith %}
{% with simple_or_complex=attribute.type.simple|yesno:"simple,complex" %}
{% with template_name="GithubObject.AttributeValue."|add:simple_or_complex|add:".py" %}
diff --git a/codegen/templates/GithubObject.MethodBody.ReturnValue.py b/codegen/templates/GithubObject.MethodBody.ReturnValue.py
index f51c09ad..b3d89e7c 100644
--- a/codegen/templates/GithubObject.MethodBody.ReturnValue.py
+++ b/codegen/templates/GithubObject.MethodBody.ReturnValue.py
@@ -1,12 +1,12 @@
-{% if method.type.name == "bool" %}status == 204
-{% else %}{% if method.type.simple %}data
-{% else %}{% if method.type.cardinality == "scalar" %}{% if method.type.name != class.name %}{{ method.type.name }}.{% endif %}{{ method.type.name }}( self._requester, data, completed = True )
-{% else %}PaginatedList.PaginatedList(
- {% if method.type.name != class.name %}{{ method.type.name }}.{% endif %}{{ method.type.name }},
- self._requester,
- headers,
- data
- )
-{% endif %}
-{% endif %}
-{% endif %}
+{% if method.type.name == "bool" %}status == 204
+{% else %}{% if method.type.simple %}data
+{% else %}{% if method.type.cardinality == "scalar" %}{% if method.type.name != class.name %}{{ method.type.name }}.{% endif %}{{ method.type.name }}( self._requester, data, completed = True )
+{% else %}PaginatedList.PaginatedList(
+ {% if method.type.name != class.name %}{{ method.type.name }}.{% endif %}{{ method.type.name }},
+ self._requester,
+ headers,
+ data
+ )
+{% endif %}
+{% endif %}
+{% endif %}
diff --git a/github/GithubObject.py b/github/GithubObject.py
index 22ee9c19..10d2f789 100644
--- a/github/GithubObject.py
+++ b/github/GithubObject.py
@@ -1,67 +1,67 @@
-# Copyright 2012 Vincent Jacques
-# vincent@vincent-jacques.net
-
-# This file is part of PyGithub. http://vincent-jacques.net/PyGithub
-
-# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
-# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-
-# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see .
-
-import datetime
-
-import GithubException
-
-class _NotSetType:
- pass
-NotSet = _NotSetType()
-
-class BasicGithubObject( object ):
- def __init__( self, requester, attributes, completed ): ### 'completed' may be removed if I find a way
- self._requester = requester
- self._initAttributes()
- self._useAttributes( attributes )
-
- @staticmethod
- def _parentUrl( url ):
- return "/".join( url.split( "/" )[ : -1 ] )
-
- @staticmethod
- def _NoneIfNotSet( value ):
- if value is NotSet:
- return None
- else:
- return value
-
- @staticmethod
- def _parseDatetime( s ):
- if s is None:
- return None
- elif len( s ) == 24:
- return datetime.datetime.strptime( s, "%Y-%m-%dT%H:%M:%S.000Z" )
- elif len( s ) == 25:
- return datetime.datetime.strptime( s[ : 19 ], "%Y-%m-%dT%H:%M:%S" ) + ( 1 if s[ 19 ] == '-' else -1 ) * datetime.timedelta( hours = int( s[ 20 : 22 ] ), minutes = int( s[ 23 : 25 ] ) )
- else:
- return datetime.datetime.strptime( s, "%Y-%m-%dT%H:%M:%SZ" )
-
-class GithubObject( BasicGithubObject ):
- def __init__( self, requester, attributes, completed ):
- BasicGithubObject.__init__( self, requester, attributes, completed )
- self.__completed = completed
-
- def _completeIfNotSet( self, value ):
- if not self.__completed and value is NotSet:
- self.__complete()
-
- def __complete( self ):
- headers, data = self._requester.requestAndCheck(
- "GET",
- self._url,
- None,
- None
- )
- self._useAttributes( data )
- self._completed = True
+# Copyright 2012 Vincent Jacques
+# vincent@vincent-jacques.net
+
+# This file is part of PyGithub. http://vincent-jacques.net/PyGithub
+
+# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
+# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see .
+
+import datetime
+
+import GithubException
+
+class _NotSetType:
+ pass
+NotSet = _NotSetType()
+
+class BasicGithubObject( object ):
+ def __init__( self, requester, attributes, completed ): ### 'completed' may be removed if I find a way
+ self._requester = requester
+ self._initAttributes()
+ self._useAttributes( attributes )
+
+ @staticmethod
+ def _parentUrl( url ):
+ return "/".join( url.split( "/" )[ : -1 ] )
+
+ @staticmethod
+ def _NoneIfNotSet( value ):
+ if value is NotSet:
+ return None
+ else:
+ return value
+
+ @staticmethod
+ def _parseDatetime( s ):
+ if s is None:
+ return None
+ elif len( s ) == 24:
+ return datetime.datetime.strptime( s, "%Y-%m-%dT%H:%M:%S.000Z" )
+ elif len( s ) == 25:
+ return datetime.datetime.strptime( s[ : 19 ], "%Y-%m-%dT%H:%M:%S" ) + ( 1 if s[ 19 ] == '-' else -1 ) * datetime.timedelta( hours = int( s[ 20 : 22 ] ), minutes = int( s[ 23 : 25 ] ) )
+ else:
+ return datetime.datetime.strptime( s, "%Y-%m-%dT%H:%M:%SZ" )
+
+class GithubObject( BasicGithubObject ):
+ def __init__( self, requester, attributes, completed ):
+ BasicGithubObject.__init__( self, requester, attributes, completed )
+ self.__completed = completed
+
+ def _completeIfNotSet( self, value ):
+ if not self.__completed and value is NotSet:
+ self.__complete()
+
+ def __complete( self ):
+ headers, data = self._requester.requestAndCheck(
+ "GET",
+ self._url,
+ None,
+ None
+ )
+ self._useAttributes( data )
+ self._completed = True
diff --git a/github/InputFileContent.py b/github/InputFileContent.py
index 5815cdf3..2977b2fa 100644
--- a/github/InputFileContent.py
+++ b/github/InputFileContent.py
@@ -1,22 +1,22 @@
-# Copyright 2012 Vincent Jacques
-# vincent@vincent-jacques.net
-
-# This file is part of PyGithub. http://vincent-jacques.net/PyGithub
-
-# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
-# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-
-# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see .
-
-class InputFileContent( object ):
- def __init__( self, content ):
- self.__content = content
-
- @property
- def _identity( self ):
- return {
- "content": self.__content,
- }
+# Copyright 2012 Vincent Jacques
+# vincent@vincent-jacques.net
+
+# This file is part of PyGithub. http://vincent-jacques.net/PyGithub
+
+# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
+# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see .
+
+class InputFileContent( object ):
+ def __init__( self, content ):
+ self.__content = content
+
+ @property
+ def _identity( self ):
+ return {
+ "content": self.__content,
+ }
diff --git a/github/InputGitAuthor.py b/github/InputGitAuthor.py
index 0c383e7e..24e340fd 100644
--- a/github/InputGitAuthor.py
+++ b/github/InputGitAuthor.py
@@ -1,26 +1,26 @@
-# Copyright 2012 Vincent Jacques
-# vincent@vincent-jacques.net
-
-# This file is part of PyGithub. http://vincent-jacques.net/PyGithub
-
-# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
-# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-
-# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see .
-
-class InputGitAuthor( object ):
- def __init__( self, name, email, date ):
- self.__name = name
- self.__email = email
- self.__date = date
-
- @property
- def _identity( self ):
- return {
- "name": self.__name,
- "email": self.__email,
- "date": self.__date,
- }
+# Copyright 2012 Vincent Jacques
+# vincent@vincent-jacques.net
+
+# This file is part of PyGithub. http://vincent-jacques.net/PyGithub
+
+# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
+# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see .
+
+class InputGitAuthor( object ):
+ def __init__( self, name, email, date ):
+ self.__name = name
+ self.__email = email
+ self.__date = date
+
+ @property
+ def _identity( self ):
+ return {
+ "name": self.__name,
+ "email": self.__email,
+ "date": self.__date,
+ }
diff --git a/github/InputGitTreeElement.py b/github/InputGitTreeElement.py
index 5215231d..96274487 100644
--- a/github/InputGitTreeElement.py
+++ b/github/InputGitTreeElement.py
@@ -1,35 +1,35 @@
-# Copyright 2012 Vincent Jacques
-# vincent@vincent-jacques.net
-
-# This file is part of PyGithub. http://vincent-jacques.net/PyGithub
-
-# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
-# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-
-# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see .
-
-import GithubObject
-
-class InputGitTreeElement( object ):
- def __init__( self, path, mode, type, content = GithubObject.NotSet, sha = GithubObject.NotSet ):
- self.__path = path
- self.__mode = mode
- self.__type = type
- self.__content = content
- self.__sha = sha
-
- @property
- def _identity( self ):
- identity = {
- "path": self.__path,
- "mode": self.__mode,
- "type": self.__type,
- }
- if self.__sha is not GithubObject.NotSet:
- identity[ "sha" ] = self.__sha
- if self.__content is not GithubObject.NotSet:
- identity[ "content" ] = self.__content
- return identity
+# Copyright 2012 Vincent Jacques
+# vincent@vincent-jacques.net
+
+# This file is part of PyGithub. http://vincent-jacques.net/PyGithub
+
+# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
+# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see .
+
+import GithubObject
+
+class InputGitTreeElement( object ):
+ def __init__( self, path, mode, type, content = GithubObject.NotSet, sha = GithubObject.NotSet ):
+ self.__path = path
+ self.__mode = mode
+ self.__type = type
+ self.__content = content
+ self.__sha = sha
+
+ @property
+ def _identity( self ):
+ identity = {
+ "path": self.__path,
+ "mode": self.__mode,
+ "type": self.__type,
+ }
+ if self.__sha is not GithubObject.NotSet:
+ identity[ "sha" ] = self.__sha
+ if self.__content is not GithubObject.NotSet:
+ identity[ "content" ] = self.__content
+ return identity
diff --git a/github/Legacy.py b/github/Legacy.py
index 52b33e74..3614b6f5 100644
--- a/github/Legacy.py
+++ b/github/Legacy.py
@@ -1,74 +1,74 @@
-# Copyright 2012 Vincent Jacques
-# vincent@vincent-jacques.net
-
-# This file is part of PyGithub. http://vincent-jacques.net/PyGithub
-
-# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
-# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-
-# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see .
-
-from PaginatedList import PaginatedListBase
-
-class PaginatedList( PaginatedListBase ):
- def __init__( self, url, args, requester, key, convert, contentClass ):
- PaginatedListBase.__init__( self, list() )
- self.__url = url
- self.__args = args
- self.__requester = requester
- self.__key = key
- self.__convert = convert
- self.__contentClass = contentClass
- self.__nextPage = 1
- self.__continue = True
- self.__elements = list()
-
- def _couldGrow( self ):
- return self.__continue
-
- def _fetchNextPage( self ):
- if self.__nextPage != 1:
- self.__args[ "start_page" ] = self.__nextPage
- self.__nextPage += 1
- headers, data = self.__requester.requestAndCheck(
- "GET",
- self.__url,
- self.__args,
- None
- )
- self.__continue = len( data[ self.__key ] ) > 0
- return [
- self.__contentClass( self.__requester, self.__convert( element ), completed = False )
- for element in data[ self.__key ]
- ]
-
-def convertUser( attributes ):
- login = attributes[ "login" ]
- return {
- "login": login,
- "url": "/users/" + login,
- }
-
-def convertRepo( attributes ):
- owner = attributes[ "owner" ]
- name = attributes[ "name" ]
- return {
- "owner": { "login": owner },
- "name": name,
- "url": "/repos/" + owner + "/" + name,
- }
-
-def convertIssue( attributes ):
- number = attributes[ "number" ]
- title = attributes[ "title" ]
- html_url = attributes[ "html_url" ]
- assert html_url.startswith( "https://github.com/" )
- url = html_url.replace( "https://github.com/", "/repos/" )
- return {
- "title": title,
- "number": number,
- "url": url,
- }
+# Copyright 2012 Vincent Jacques
+# vincent@vincent-jacques.net
+
+# This file is part of PyGithub. http://vincent-jacques.net/PyGithub
+
+# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
+# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see .
+
+from PaginatedList import PaginatedListBase
+
+class PaginatedList( PaginatedListBase ):
+ def __init__( self, url, args, requester, key, convert, contentClass ):
+ PaginatedListBase.__init__( self, list() )
+ self.__url = url
+ self.__args = args
+ self.__requester = requester
+ self.__key = key
+ self.__convert = convert
+ self.__contentClass = contentClass
+ self.__nextPage = 1
+ self.__continue = True
+ self.__elements = list()
+
+ def _couldGrow( self ):
+ return self.__continue
+
+ def _fetchNextPage( self ):
+ if self.__nextPage != 1:
+ self.__args[ "start_page" ] = self.__nextPage
+ self.__nextPage += 1
+ headers, data = self.__requester.requestAndCheck(
+ "GET",
+ self.__url,
+ self.__args,
+ None
+ )
+ self.__continue = len( data[ self.__key ] ) > 0
+ return [
+ self.__contentClass( self.__requester, self.__convert( element ), completed = False )
+ for element in data[ self.__key ]
+ ]
+
+def convertUser( attributes ):
+ login = attributes[ "login" ]
+ return {
+ "login": login,
+ "url": "/users/" + login,
+ }
+
+def convertRepo( attributes ):
+ owner = attributes[ "owner" ]
+ name = attributes[ "name" ]
+ return {
+ "owner": { "login": owner },
+ "name": name,
+ "url": "/repos/" + owner + "/" + name,
+ }
+
+def convertIssue( attributes ):
+ number = attributes[ "number" ]
+ title = attributes[ "title" ]
+ html_url = attributes[ "html_url" ]
+ assert html_url.startswith( "https://github.com/" )
+ url = html_url.replace( "https://github.com/", "/repos/" )
+ return {
+ "title": title,
+ "number": number,
+ "url": url,
+ }
diff --git a/publish.sh b/publish.sh
old mode 100644
new mode 100755
index e92b6bf0..486ae9a0
--- a/publish.sh
+++ b/publish.sh
@@ -1,26 +1,26 @@
-#!/bin/sh
-
-./run_tests.sh
-
-previousVersion=$( grep 'version =' setup.py | sed 's/.*version = \"\(.*\)\".*/\1/' )
-echo "Next version number? (previous: '$previousVersion')"
-read version
-sed -i -b "s/version = .*/version = \"$version\",/" setup.py
-git add setup.py
-
-echo "Edit ReadMe.md now, then press enter"
-read
-git add ReadMe.md
-
-echo "Breack (Ctrl+c) here if something is wrong. Else, press enter"
-read
-
-git commit -m "Publish version $version"
-git tag -m "Version $version" v$version
-
-cp -r *.md doc COPYING* github
-python setup.py sdist upload
-rm -rf github/*.md github/doc github/COPYING*
-
-git push origin master master:develop
-git push --tags
+#!/bin/sh
+
+./run_tests.sh
+
+previousVersion=$( grep 'version =' setup.py | sed 's/.*version = \"\(.*\)\".*/\1/' )
+echo "Next version number? (previous: '$previousVersion')"
+read version
+sed -i -b "s/version = .*/version = \"$version\",/" setup.py
+git add setup.py
+
+echo "Edit ReadMe.md now, then press enter"
+read
+git add ReadMe.md
+
+echo "Breack (Ctrl+c) here if something is wrong. Else, press enter"
+read
+
+git commit -m "Publish version $version"
+git tag -m "Version $version" v$version
+
+cp -r *.md doc COPYING* github
+python setup.py sdist upload
+rm -rf github/*.md github/doc github/COPYING*
+
+git push origin master master:develop
+git push --tags
diff --git a/setup.py b/setup.py
old mode 100644
new mode 100755
diff --git a/test/Enterprise.py b/test/Enterprise.py
index f1033e7b..9058c608 100644
--- a/test/Enterprise.py
+++ b/test/Enterprise.py
@@ -1,36 +1,36 @@
-# Copyright 2012 Vincent Jacques
-# vincent@vincent-jacques.net
-
-# This file is part of PyGithub. http://vincent-jacques.net/PyGithub
-
-# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
-# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-
-# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see .
-
-import github
-
-import Framework
-
-# Replay data for this test case is forged, because I don't have access to a real Github Enterprise install
-class Enterprise( Framework.BasicTestCase ):
- def testHttps( self ):
- g = github.Github( self.login, self.password, base_url = "https://my.enterprise.com" )
- 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" ] )
-
- def testHttp( self ):
- g = github.Github( self.login, self.password, base_url = "http://my.enterprise.com" )
- 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" ] )
-
- def testLongUrl( self ):
- g = github.Github( self.login, self.password, base_url = "http://my.enterprise.com/path/to/github" )
- repos = g.get_user().get_repos()
- 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" ] )
- self.assertEqual( repos[ 0 ].owner.name, "Vincent Jacques" )
-
- def testSpecificPort( self ):
- g = github.Github( self.login, self.password, base_url = "http://my.enterprise.com:8080" )
- 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" ] )
+# Copyright 2012 Vincent Jacques
+# vincent@vincent-jacques.net
+
+# This file is part of PyGithub. http://vincent-jacques.net/PyGithub
+
+# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
+# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see .
+
+import github
+
+import Framework
+
+# Replay data for this test case is forged, because I don't have access to a real Github Enterprise install
+class Enterprise( Framework.BasicTestCase ):
+ def testHttps( self ):
+ g = github.Github( self.login, self.password, base_url = "https://my.enterprise.com" )
+ 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" ] )
+
+ def testHttp( self ):
+ g = github.Github( self.login, self.password, base_url = "http://my.enterprise.com" )
+ 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" ] )
+
+ def testLongUrl( self ):
+ g = github.Github( self.login, self.password, base_url = "http://my.enterprise.com/path/to/github" )
+ repos = g.get_user().get_repos()
+ 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" ] )
+ self.assertEqual( repos[ 0 ].owner.name, "Vincent Jacques" )
+
+ def testSpecificPort( self ):
+ g = github.Github( self.login, self.password, base_url = "http://my.enterprise.com:8080" )
+ 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" ] )
diff --git a/test/Issue54.py b/test/Issue54.py
index 52221878..c759831d 100644
--- a/test/Issue54.py
+++ b/test/Issue54.py
@@ -1,26 +1,26 @@
-# Copyright 2012 Vincent Jacques
-# vincent@vincent-jacques.net
-
-# This file is part of PyGithub. http://vincent-jacques.net/PyGithub
-
-# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
-# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-
-# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see .
-
-import datetime
-
-import Framework
-
-class Issue54( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.repo = self.g.get_user().get_repo( "TestRepo" )
-
- def testConversion( self ):
- commit = self.repo.get_git_commit( "73f320ae06cd565cf38faca34b6a482addfc721b" )
- self.assertEqual( commit.message, "Test commit created around Fri, 13 Jul 2012 18:43:21 GMT, that is vendredi 13 juillet 2012 20:43:21 GMT+2\n" )
- self.assertEqual( commit.author.date, datetime.datetime( 2012, 7, 13, 18, 47, 10 ) )
+# Copyright 2012 Vincent Jacques
+# vincent@vincent-jacques.net
+
+# This file is part of PyGithub. http://vincent-jacques.net/PyGithub
+
+# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
+# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see .
+
+import datetime
+
+import Framework
+
+class Issue54( Framework.TestCase ):
+ def setUp( self ):
+ Framework.TestCase.setUp( self )
+ self.repo = self.g.get_user().get_repo( "TestRepo" )
+
+ def testConversion( self ):
+ commit = self.repo.get_git_commit( "73f320ae06cd565cf38faca34b6a482addfc721b" )
+ self.assertEqual( commit.message, "Test commit created around Fri, 13 Jul 2012 18:43:21 GMT, that is vendredi 13 juillet 2012 20:43:21 GMT+2\n" )
+ self.assertEqual( commit.author.date, datetime.datetime( 2012, 7, 13, 18, 47, 10 ) )
diff --git a/test/Markdown.py b/test/Markdown.py
index 971fa167..bab5ff01 100644
--- a/test/Markdown.py
+++ b/test/Markdown.py
@@ -1,26 +1,26 @@
-# Copyright 2012 Vincent Jacques
-# vincent@vincent-jacques.net
-
-# This file is part of PyGithub. http://vincent-jacques.net/PyGithub
-
-# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
-# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-
-# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see .
-
-import Framework
-
-class Markdown( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.text = "MyTitle\n=======\n\nIssue #1"
- self.repo = self.g.get_user().get_repo( "PyGithub" )
-
- def testRenderMarkdown( self ):
- self.assertEqual( self.g.render_markdown( self.text ), '
MyTitle
Issue #1
' )
-
- def testRenderGithubFlavoredMarkdown( self ):
- self.assertEqual( self.g.render_markdown( self.text, self.repo ), 'MyTitle
Issue #1
' )
+# Copyright 2012 Vincent Jacques
+# vincent@vincent-jacques.net
+
+# This file is part of PyGithub. http://vincent-jacques.net/PyGithub
+
+# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
+# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see .
+
+import Framework
+
+class Markdown( Framework.TestCase ):
+ def setUp( self ):
+ Framework.TestCase.setUp( self )
+ self.text = "MyTitle\n=======\n\nIssue #1"
+ self.repo = self.g.get_user().get_repo( "PyGithub" )
+
+ def testRenderMarkdown( self ):
+ self.assertEqual( self.g.render_markdown( self.text ), 'MyTitle
Issue #1
' )
+
+ def testRenderGithubFlavoredMarkdown( self ):
+ self.assertEqual( self.g.render_markdown( self.text, self.repo ), 'MyTitle
Issue #1
' )
diff --git a/test/PaginatedList.py b/test/PaginatedList.py
index 4ff6971d..5c61eb20 100644
--- a/test/PaginatedList.py
+++ b/test/PaginatedList.py
@@ -1,67 +1,67 @@
-# Copyright 2012 Vincent Jacques
-# vincent@vincent-jacques.net
-
-# This file is part of PyGithub. http://vincent-jacques.net/PyGithub
-
-# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
-# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-
-# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see .
-
-import Framework
-
-class PaginatedList( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.list = self.g.get_user( "openframeworks" ).get_repo( "openFrameworks" ).get_issues()
-
- def testIteration( self ):
- self.assertEqual( len( list( self.list ) ), 333 )
-
- def testIntIndexingInFirstPage( self ):
- self.assertEqual( self.list[ 0 ].id, 4772349 )
- self.assertEqual( self.list[ 24 ].id, 4286936 )
-
- def testIntIndexingInThirdPage( self ):
- self.assertEqual( self.list[ 50 ].id, 3911629 )
- self.assertEqual( self.list[ 74 ].id, 3605277 )
-
- def testIntIndexingAfterIteration( self ):
- self.assertEqual( len( list( self.list ) ), 333 )
- self.assertEqual( self.list[ 11 ].id, 4507572 )
- self.assertEqual( self.list[ 73 ].id, 3614231 )
- self.assertEqual( self.list[ 332 ].id, 94898 )
-
- def testSliceIndexingInFirstPage( self ):
- self.assertListKeyEqual( self.list[ : 13 ], lambda i: i.id, [ 4772349, 4767675, 4758608, 4700182, 4662873, 4608132, 4604661, 4588997, 4557803, 4554058, 4539985, 4507572, 4507492 ] )
- self.assertListKeyEqual( self.list[ : 13 : 3 ], lambda i: i.id, [ 4772349, 4700182, 4604661, 4554058, 4507492 ] )
- self.assertListKeyEqual( self.list[ 10 : 13 ], lambda i: i.id, [ 4539985, 4507572, 4507492 ] )
- self.assertListKeyEqual( self.list[ 5 : 13 : 3 ], lambda i: i.id, [ 4608132, 4557803, 4507572 ] )
-
- def testSliceIndexingUntilFourthPage( self ):
- self.assertListKeyEqual( self.list[ : 99 : 10 ], lambda i: i.id, [ 4772349, 4539985, 4370619, 4207350, 4063366, 3911629, 3813852, 3647640, 3528378, 3438233 ] )
- self.assertListKeyEqual( self.list[ 73 : 78 ], lambda i: i.id, [ 3614231, 3605277, 3596240, 3594731, 3593619 ] )
- self.assertListKeyEqual( self.list[ 70 : 80 : 2 ], lambda i: i.id, [ 3647640, 3627067, 3605277, 3594731, 3593430 ] )
-
- def testSliceIndexingUntilEnd( self ):
- self.assertListKeyEqual( self.list[ 310 : : 3 ], lambda i: i.id, [ 268332, 204247, 169176, 166211, 165898, 163959, 132373, 104702 ] )
- self.assertListKeyEqual( self.list[ 310 : ], lambda i: i.id, [ 268332, 211418, 205935, 204247, 172424, 171615, 169176, 166214, 166212, 166211, 166209, 166208, 165898, 165537, 165409, 163959, 132671, 132377, 132373, 130269, 111018, 104702, 94898 ] )
-
- def testInterruptedIteration( self ):
- # No asserts, but checks that only three pages are fetched
- l = 0
- for element in self.list:
- l += 1
- if l == 75:
- break
-
- def testInterruptedIterationInSlice( self ):
- # No asserts, but checks that only three pages are fetched
- l = 0
- for element in self.list[ :100 ]:
- l += 1
- if l == 75:
- break
+# Copyright 2012 Vincent Jacques
+# vincent@vincent-jacques.net
+
+# This file is part of PyGithub. http://vincent-jacques.net/PyGithub
+
+# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
+# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see .
+
+import Framework
+
+class PaginatedList( Framework.TestCase ):
+ def setUp( self ):
+ Framework.TestCase.setUp( self )
+ self.list = self.g.get_user( "openframeworks" ).get_repo( "openFrameworks" ).get_issues()
+
+ def testIteration( self ):
+ self.assertEqual( len( list( self.list ) ), 333 )
+
+ def testIntIndexingInFirstPage( self ):
+ self.assertEqual( self.list[ 0 ].id, 4772349 )
+ self.assertEqual( self.list[ 24 ].id, 4286936 )
+
+ def testIntIndexingInThirdPage( self ):
+ self.assertEqual( self.list[ 50 ].id, 3911629 )
+ self.assertEqual( self.list[ 74 ].id, 3605277 )
+
+ def testIntIndexingAfterIteration( self ):
+ self.assertEqual( len( list( self.list ) ), 333 )
+ self.assertEqual( self.list[ 11 ].id, 4507572 )
+ self.assertEqual( self.list[ 73 ].id, 3614231 )
+ self.assertEqual( self.list[ 332 ].id, 94898 )
+
+ def testSliceIndexingInFirstPage( self ):
+ self.assertListKeyEqual( self.list[ : 13 ], lambda i: i.id, [ 4772349, 4767675, 4758608, 4700182, 4662873, 4608132, 4604661, 4588997, 4557803, 4554058, 4539985, 4507572, 4507492 ] )
+ self.assertListKeyEqual( self.list[ : 13 : 3 ], lambda i: i.id, [ 4772349, 4700182, 4604661, 4554058, 4507492 ] )
+ self.assertListKeyEqual( self.list[ 10 : 13 ], lambda i: i.id, [ 4539985, 4507572, 4507492 ] )
+ self.assertListKeyEqual( self.list[ 5 : 13 : 3 ], lambda i: i.id, [ 4608132, 4557803, 4507572 ] )
+
+ def testSliceIndexingUntilFourthPage( self ):
+ self.assertListKeyEqual( self.list[ : 99 : 10 ], lambda i: i.id, [ 4772349, 4539985, 4370619, 4207350, 4063366, 3911629, 3813852, 3647640, 3528378, 3438233 ] )
+ self.assertListKeyEqual( self.list[ 73 : 78 ], lambda i: i.id, [ 3614231, 3605277, 3596240, 3594731, 3593619 ] )
+ self.assertListKeyEqual( self.list[ 70 : 80 : 2 ], lambda i: i.id, [ 3647640, 3627067, 3605277, 3594731, 3593430 ] )
+
+ def testSliceIndexingUntilEnd( self ):
+ self.assertListKeyEqual( self.list[ 310 : : 3 ], lambda i: i.id, [ 268332, 204247, 169176, 166211, 165898, 163959, 132373, 104702 ] )
+ self.assertListKeyEqual( self.list[ 310 : ], lambda i: i.id, [ 268332, 211418, 205935, 204247, 172424, 171615, 169176, 166214, 166212, 166211, 166209, 166208, 165898, 165537, 165409, 163959, 132671, 132377, 132373, 130269, 111018, 104702, 94898 ] )
+
+ def testInterruptedIteration( self ):
+ # No asserts, but checks that only three pages are fetched
+ l = 0
+ for element in self.list:
+ l += 1
+ if l == 75:
+ break
+
+ def testInterruptedIterationInSlice( self ):
+ # No asserts, but checks that only three pages are fetched
+ l = 0
+ for element in self.list[ :100 ]:
+ l += 1
+ if l == 75:
+ break