diff --git a/.travis.yml b/.travis.yml
index 6e717c33..ac1f0ce8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,5 +3,5 @@ python:
- "2.7"
- "2.6"
- "2.5"
-install: if [ "$(python --version 2>&1)" == "Python 2.5.6" ]; then pip install -r python25-requirements.txt --use-mirrors; fi
+install: if [ "$(python --version 2>&1)" == "Python 2.5.6" ]; then pip install -r python25-requirements.txt --use-mirrors; fi; if [ "$(python --version 2>&1)" == "Python 2.6.8" ]; then pip install -r python26-requirements.txt --use-mirrors; fi
script: python ./setup.py test
diff --git a/doc/ReferenceOfClasses.md b/doc/ReferenceOfClasses.md
index 3db332e4..048354cc 100644
--- a/doc/ReferenceOfClasses.md
+++ b/doc/ReferenceOfClasses.md
@@ -170,7 +170,7 @@ Orgs
Repos
-----
-* `create_repo( name, [description, homepage, private, has_issues, has_wiki, has_downloads] )`: `Repository`
+* `create_repo( name, [description, homepage, private, has_issues, has_wiki, has_downloads, auto_init, gitignore_template] )`: `Repository`
* `name`: string
* `description`: string
* `homepage`: string
@@ -178,6 +178,8 @@ Repos
* `has_issues`: bool
* `has_wiki`: bool
* `has_downloads`: bool
+ * `auto_init`: bool
+ * `gitignore_template`: string
* `get_repo( name )`: `Repository`
* `name`: string
* `get_repos( [type, sort, direction] )`: `PaginatedList` of `Repository`
@@ -965,7 +967,7 @@ Public_members
Repos
-----
-* `create_repo( name, [description, homepage, private, has_issues, has_wiki, has_downloads, team_id] )`: `Repository`
+* `create_repo( name, [description, homepage, private, has_issues, has_wiki, has_downloads, team_id, auto_init, gitignore_template] )`: `Repository`
* `name`: string
* `description`: string
* `homepage`: string
@@ -974,6 +976,8 @@ Repos
* `has_wiki`: bool
* `has_downloads`: bool
* `team_id`: `Team`
+ * `auto_init`: bool
+ * `gitignore_template`: string
* `get_repo( name )`: `Repository`
* `name`: string
* `get_repos( [type] )`: `PaginatedList` of `Repository`
@@ -1014,6 +1018,7 @@ Class `PullRequest`
Attributes
----------
* `additions`: integer
+* `assignee`: `NamedUser`
* `base`: `PullRequestPart`
* `body`: string
* `changed_files`: integer
@@ -1374,7 +1379,7 @@ Milestones
Modification
------------
-* `edit( name, [description, homepage, public, has_issues, has_wiki, has_downloads] )`
+* `edit( name, [description, homepage, public, has_issues, has_wiki, has_downloads, default_branch] )`
* `name`: string
* `description`: string
* `homepage`: string
@@ -1382,6 +1387,7 @@ Modification
* `has_issues`: bool
* `has_wiki`: bool
* `has_downloads`: bool
+ * `default_branch`: string
Pulls
-----
diff --git a/github/AuthenticatedUser.py b/github/AuthenticatedUser.py
index 684c2142..f131d625 100644
--- a/github/AuthenticatedUser.py
+++ b/github/AuthenticatedUser.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
@@ -260,7 +262,7 @@ class AuthenticatedUser(GithubObject.GithubObject):
)
return UserKey.UserKey(self._requester, data, completed=True)
- def create_repo(self, name, description=GithubObject.NotSet, homepage=GithubObject.NotSet, private=GithubObject.NotSet, has_issues=GithubObject.NotSet, has_wiki=GithubObject.NotSet, has_downloads=GithubObject.NotSet):
+ def create_repo(self, name, description=GithubObject.NotSet, homepage=GithubObject.NotSet, private=GithubObject.NotSet, has_issues=GithubObject.NotSet, has_wiki=GithubObject.NotSet, has_downloads=GithubObject.NotSet, auto_init=GithubObject.NotSet, gitignore_template=GithubObject.NotSet):
assert isinstance(name, (str, unicode)), name
assert description is GithubObject.NotSet or isinstance(description, (str, unicode)), description
assert homepage is GithubObject.NotSet or isinstance(homepage, (str, unicode)), homepage
@@ -268,6 +270,8 @@ class AuthenticatedUser(GithubObject.GithubObject):
assert has_issues is GithubObject.NotSet or isinstance(has_issues, bool), has_issues
assert has_wiki is GithubObject.NotSet or isinstance(has_wiki, bool), has_wiki
assert has_downloads is GithubObject.NotSet or isinstance(has_downloads, bool), has_downloads
+ assert auto_init is GithubObject.NotSet or isinstance(auto_init, bool), auto_init
+ assert gitignore_template is GithubObject.NotSet or isinstance(gitignore_template, (str, unicode)), gitignore_template
post_parameters = {
"name": name,
}
@@ -283,6 +287,10 @@ class AuthenticatedUser(GithubObject.GithubObject):
post_parameters["has_wiki"] = has_wiki
if has_downloads is not GithubObject.NotSet:
post_parameters["has_downloads"] = has_downloads
+ if auto_init is not GithubObject.NotSet:
+ post_parameters["auto_init"] = auto_init
+ if gitignore_template is not GithubObject.NotSet:
+ post_parameters["gitignore_template"] = gitignore_template
headers, data = self._requester.requestAndCheck(
"POST",
"/user/repos",
diff --git a/github/Authorization.py b/github/Authorization.py
index 1271624c..91805330 100644
--- a/github/Authorization.py
+++ b/github/Authorization.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/AuthorizationApplication.py b/github/AuthorizationApplication.py
index ee23a727..e99844dc 100644
--- a/github/AuthorizationApplication.py
+++ b/github/AuthorizationApplication.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/Branch.py b/github/Branch.py
index 4c99ed11..a49e9a7a 100644
--- a/github/Branch.py
+++ b/github/Branch.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/Commit.py b/github/Commit.py
index c0e8d075..2849285b 100644
--- a/github/Commit.py
+++ b/github/Commit.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/CommitComment.py b/github/CommitComment.py
index 53c09632..d3e0e47f 100644
--- a/github/CommitComment.py
+++ b/github/CommitComment.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/CommitStats.py b/github/CommitStats.py
index e5b3b6ba..03001a24 100644
--- a/github/CommitStats.py
+++ b/github/CommitStats.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/CommitStatus.py b/github/CommitStatus.py
index 715ceece..08479073 100644
--- a/github/CommitStatus.py
+++ b/github/CommitStatus.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/Comparison.py b/github/Comparison.py
index fe1622ea..494240ed 100644
--- a/github/Comparison.py
+++ b/github/Comparison.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/ContentFile.py b/github/ContentFile.py
index b69b611b..1026e795 100644
--- a/github/ContentFile.py
+++ b/github/ContentFile.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/Download.py b/github/Download.py
index 8551d9b6..e54bbfbe 100644
--- a/github/Download.py
+++ b/github/Download.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/Event.py b/github/Event.py
index 496b660c..4c8b3b3b 100644
--- a/github/Event.py
+++ b/github/Event.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/File.py b/github/File.py
index e3395910..0dedb3cd 100644
--- a/github/File.py
+++ b/github/File.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/Gist.py b/github/Gist.py
index c3b382a5..f583a321 100644
--- a/github/Gist.py
+++ b/github/Gist.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/GistComment.py b/github/GistComment.py
index 4273987b..aa8f73cb 100644
--- a/github/GistComment.py
+++ b/github/GistComment.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/GistFile.py b/github/GistFile.py
index 194f64ed..1b8aba3e 100644
--- a/github/GistFile.py
+++ b/github/GistFile.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/GistHistoryState.py b/github/GistHistoryState.py
index 19a46abc..0c214fff 100644
--- a/github/GistHistoryState.py
+++ b/github/GistHistoryState.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/GitAuthor.py b/github/GitAuthor.py
index 4e99645b..a14f31c9 100644
--- a/github/GitAuthor.py
+++ b/github/GitAuthor.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/GitBlob.py b/github/GitBlob.py
index 6e47584a..19b10589 100644
--- a/github/GitBlob.py
+++ b/github/GitBlob.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/GitCommit.py b/github/GitCommit.py
index cd3a7057..0dcf1de5 100644
--- a/github/GitCommit.py
+++ b/github/GitCommit.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/GitObject.py b/github/GitObject.py
index 15ed92b5..5b6b308b 100644
--- a/github/GitObject.py
+++ b/github/GitObject.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/GitRef.py b/github/GitRef.py
index eab64cc8..58b2426f 100644
--- a/github/GitRef.py
+++ b/github/GitRef.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/GitTag.py b/github/GitTag.py
index e8a030b1..664bc8aa 100644
--- a/github/GitTag.py
+++ b/github/GitTag.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/GitTree.py b/github/GitTree.py
index 70c5b64e..3af066ab 100644
--- a/github/GitTree.py
+++ b/github/GitTree.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/GitTreeElement.py b/github/GitTreeElement.py
index 6c5c463b..e2b1a63e 100644
--- a/github/GitTreeElement.py
+++ b/github/GitTreeElement.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/Github.py b/github/Github.py
index 9bb2cca9..413072b7 100644
--- a/github/Github.py
+++ b/github/Github.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
@@ -33,14 +35,14 @@ class Github(object):
def __init__(self, login_or_token=None, password=None, base_url=DEFAULT_BASE_URL, timeout=DEFAULT_TIMEOUT, client_id=None, client_secret=None):
self.__requester = Requester(login_or_token, password, base_url, timeout, client_id, client_secret)
- @property
- def FIX_REPO_GET_GIT_REF(self):
+ def get_FIX_REPO_GET_GIT_REF(self):
return self.__requester.FIX_REPO_GET_GIT_REF
- @FIX_REPO_GET_GIT_REF.setter
- def FIX_REPO_GET_GIT_REF(self, value):
+ def set_FIX_REPO_GET_GIT_REF(self, value):
self.__requester.FIX_REPO_GET_GIT_REF = value
+ FIX_REPO_GET_GIT_REF = property(get_FIX_REPO_GET_GIT_REF, set_FIX_REPO_GET_GIT_REF)
+
@property
def rate_limiting(self):
return self.__requester.rate_limiting
diff --git a/github/GithubException.py b/github/GithubException.py
index 626ab238..11b615a5 100644
--- a/github/GithubException.py
+++ b/github/GithubException.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/GithubObject.py b/github/GithubObject.py
index 8448e70d..76e3c4b8 100644
--- a/github/GithubObject.py
+++ b/github/GithubObject.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/Hook.py b/github/Hook.py
index cabc5f5a..9a0af68e 100644
--- a/github/Hook.py
+++ b/github/Hook.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/HookDescription.py b/github/HookDescription.py
index 6dd0d143..28e4e654 100644
--- a/github/HookDescription.py
+++ b/github/HookDescription.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/HookResponse.py b/github/HookResponse.py
index c09cfc86..a5f174cf 100644
--- a/github/HookResponse.py
+++ b/github/HookResponse.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/InputFileContent.py b/github/InputFileContent.py
index f46ab975..b3234622 100644
--- a/github/InputFileContent.py
+++ b/github/InputFileContent.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/InputGitAuthor.py b/github/InputGitAuthor.py
index c2cf8d9d..4dbacb2c 100644
--- a/github/InputGitAuthor.py
+++ b/github/InputGitAuthor.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/InputGitTreeElement.py b/github/InputGitTreeElement.py
index 290d3793..edf56150 100644
--- a/github/InputGitTreeElement.py
+++ b/github/InputGitTreeElement.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/Issue.py b/github/Issue.py
index 859c8097..282a6765 100644
--- a/github/Issue.py
+++ b/github/Issue.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/IssueComment.py b/github/IssueComment.py
index 18f72557..68d44d14 100644
--- a/github/IssueComment.py
+++ b/github/IssueComment.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/IssueEvent.py b/github/IssueEvent.py
index ba658efd..5839ae8f 100644
--- a/github/IssueEvent.py
+++ b/github/IssueEvent.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/IssuePullRequest.py b/github/IssuePullRequest.py
index 6f94cb23..e5b94375 100644
--- a/github/IssuePullRequest.py
+++ b/github/IssuePullRequest.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/Label.py b/github/Label.py
index 3dcc0d5a..1d8e7dd8 100644
--- a/github/Label.py
+++ b/github/Label.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/Legacy.py b/github/Legacy.py
index de55eb61..e09c79dc 100644
--- a/github/Legacy.py
+++ b/github/Legacy.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
@@ -59,17 +61,17 @@ def convertUser(attributes):
"login": attributes["login"],
"url": "/users/" + attributes["login"],
}
- if "gravatar_id" in attributes:
+ if "gravatar_id" in attributes: # pragma no branch
convertedAttributes["gravatar_id"] = attributes["gravatar_id"]
- if "followers" in attributes:
+ if "followers" in attributes: # pragma no branch
convertedAttributes["followers"] = attributes["followers"]
- if "repos" in attributes:
+ if "repos" in attributes: # pragma no branch
convertedAttributes["public_repos"] = attributes["repos"]
- if "name" in attributes:
+ if "name" in attributes: # pragma no branch
convertedAttributes["name"] = attributes["name"]
- if "created_at" in attributes:
+ if "created_at" in attributes: # pragma no branch
convertedAttributes["created_at"] = attributes["created_at"]
- if "location" in attributes:
+ if "location" in attributes: # pragma no branch
convertedAttributes["location"] = attributes["location"]
return convertedAttributes
@@ -79,35 +81,35 @@ def convertRepo(attributes):
"owner": {"login": attributes["owner"], "url": "/users/" + attributes["owner"]},
"url": "/repos/" + attributes["owner"] + "/" + attributes["name"],
}
- if "pushed_at" in attributes:
+ if "pushed_at" in attributes: # pragma no branch
convertedAttributes["pushed_at"] = attributes["pushed_at"]
- if "homepage" in attributes:
+ if "homepage" in attributes: # pragma no branch
convertedAttributes["homepage"] = attributes["homepage"]
- if "created_at" in attributes:
+ if "created_at" in attributes: # pragma no branch
convertedAttributes["created_at"] = attributes["created_at"]
- if "watchers" in attributes:
+ if "watchers" in attributes: # pragma no branch
convertedAttributes["watchers"] = attributes["watchers"]
- if "has_downloads" in attributes:
+ if "has_downloads" in attributes: # pragma no branch
convertedAttributes["has_downloads"] = attributes["has_downloads"]
- if "fork" in attributes:
+ if "fork" in attributes: # pragma no branch
convertedAttributes["fork"] = attributes["fork"]
- if "has_issues" in attributes:
+ if "has_issues" in attributes: # pragma no branch
convertedAttributes["has_issues"] = attributes["has_issues"]
- if "has_wiki" in attributes:
+ if "has_wiki" in attributes: # pragma no branch
convertedAttributes["has_wiki"] = attributes["has_wiki"]
- if "forks" in attributes:
+ if "forks" in attributes: # pragma no branch
convertedAttributes["forks"] = attributes["forks"]
- if "size" in attributes:
+ if "size" in attributes: # pragma no branch
convertedAttributes["size"] = attributes["size"]
- if "private" in attributes:
+ if "private" in attributes: # pragma no branch
convertedAttributes["private"] = attributes["private"]
- if "open_issues" in attributes:
+ if "open_issues" in attributes: # pragma no branch
convertedAttributes["open_issues"] = attributes["open_issues"]
- if "description" in attributes:
+ if "description" in attributes: # pragma no branch
convertedAttributes["description"] = attributes["description"]
- if "language" in attributes:
+ if "language" in attributes: # pragma no branch
convertedAttributes["language"] = attributes["language"]
- if "name" in attributes:
+ if "name" in attributes: # pragma no branch
convertedAttributes["name"] = attributes["name"]
return convertedAttributes
@@ -118,18 +120,18 @@ def convertIssue(attributes):
"url": "/repos" + urlparse.urlparse(attributes["html_url"]).path,
"user": {"login": attributes["user"], "url": "/users/" + attributes["user"]},
}
- if "labels" in attributes:
+ if "labels" in attributes: # pragma no branch
convertedAttributes["labels"] = [{"name": label} for label in attributes["labels"]]
- if "title" in attributes:
+ if "title" in attributes: # pragma no branch
convertedAttributes["title"] = attributes["title"]
- if "created_at" in attributes:
+ if "created_at" in attributes: # pragma no branch
convertedAttributes["created_at"] = attributes["created_at"]
- if "comments" in attributes:
+ if "comments" in attributes: # pragma no branch
convertedAttributes["comments"] = attributes["comments"]
- if "body" in attributes:
+ if "body" in attributes: # pragma no branch
convertedAttributes["body"] = attributes["body"]
- if "updated_at" in attributes:
+ if "updated_at" in attributes: # pragma no branch
convertedAttributes["updated_at"] = attributes["updated_at"]
- if "state" in attributes:
+ if "state" in attributes: # pragma no branch
convertedAttributes["state"] = attributes["state"]
return convertedAttributes
diff --git a/github/Milestone.py b/github/Milestone.py
index 7a0c2262..b2528665 100644
--- a/github/Milestone.py
+++ b/github/Milestone.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/NamedUser.py b/github/NamedUser.py
index e8666187..03c079dd 100644
--- a/github/NamedUser.py
+++ b/github/NamedUser.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/Organization.py b/github/Organization.py
index 90cd93e5..a64134fc 100644
--- a/github/Organization.py
+++ b/github/Organization.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
@@ -164,7 +166,7 @@ class Organization(GithubObject.GithubObject):
)
return Repository.Repository(self._requester, data, completed=True)
- def create_repo(self, name, description=GithubObject.NotSet, homepage=GithubObject.NotSet, private=GithubObject.NotSet, has_issues=GithubObject.NotSet, has_wiki=GithubObject.NotSet, has_downloads=GithubObject.NotSet, team_id=GithubObject.NotSet):
+ def create_repo(self, name, description=GithubObject.NotSet, homepage=GithubObject.NotSet, private=GithubObject.NotSet, has_issues=GithubObject.NotSet, has_wiki=GithubObject.NotSet, has_downloads=GithubObject.NotSet, team_id=GithubObject.NotSet, auto_init=GithubObject.NotSet, gitignore_template=GithubObject.NotSet):
assert isinstance(name, (str, unicode)), name
assert description is GithubObject.NotSet or isinstance(description, (str, unicode)), description
assert homepage is GithubObject.NotSet or isinstance(homepage, (str, unicode)), homepage
@@ -173,6 +175,8 @@ class Organization(GithubObject.GithubObject):
assert has_wiki is GithubObject.NotSet or isinstance(has_wiki, bool), has_wiki
assert has_downloads is GithubObject.NotSet or isinstance(has_downloads, bool), has_downloads
assert team_id is GithubObject.NotSet or isinstance(team_id, Team.Team), team_id
+ assert auto_init is GithubObject.NotSet or isinstance(auto_init, bool), auto_init
+ assert gitignore_template is GithubObject.NotSet or isinstance(gitignore_template, (str, unicode)), gitignore_template
post_parameters = {
"name": name,
}
@@ -190,6 +194,10 @@ class Organization(GithubObject.GithubObject):
post_parameters["has_downloads"] = has_downloads
if team_id is not GithubObject.NotSet:
post_parameters["team_id"] = team_id._identity
+ if auto_init is not GithubObject.NotSet:
+ post_parameters["auto_init"] = auto_init
+ if gitignore_template is not GithubObject.NotSet:
+ post_parameters["gitignore_template"] = gitignore_template
headers, data = self._requester.requestAndCheck(
"POST",
self.url + "/repos",
diff --git a/github/PaginatedList.py b/github/PaginatedList.py
index 24a14b8a..80703413 100644
--- a/github/PaginatedList.py
+++ b/github/PaginatedList.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/Permissions.py b/github/Permissions.py
index 0c776469..91d65ecf 100644
--- a/github/Permissions.py
+++ b/github/Permissions.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/Plan.py b/github/Plan.py
index 76f801be..9c9d6055 100644
--- a/github/Plan.py
+++ b/github/Plan.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/PullRequest.py b/github/PullRequest.py
index a31b4a45..eae51cf4 100644
--- a/github/PullRequest.py
+++ b/github/PullRequest.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
@@ -29,6 +31,11 @@ class PullRequest(GithubObject.GithubObject):
self._completeIfNotSet(self._additions)
return self._NoneIfNotSet(self._additions)
+ @property
+ def assignee(self):
+ self._completeIfNotSet(self._assignee)
+ return self._NoneIfNotSet(self._assignee)
+
@property
def base(self):
self._completeIfNotSet(self._base)
@@ -290,6 +297,7 @@ class PullRequest(GithubObject.GithubObject):
def _initAttributes(self):
self._additions = GithubObject.NotSet
+ self._assignee = GithubObject.NotSet
self._base = GithubObject.NotSet
self._body = GithubObject.NotSet
self._changed_files = GithubObject.NotSet
@@ -320,6 +328,9 @@ class PullRequest(GithubObject.GithubObject):
if "additions" in attributes: # pragma no branch
assert attributes["additions"] is None or isinstance(attributes["additions"], int), attributes["additions"]
self._additions = attributes["additions"]
+ if "assignee" in attributes: # pragma no branch
+ assert attributes["assignee"] is None or isinstance(attributes["assignee"], dict), attributes["assignee"]
+ self._assignee = None if attributes["assignee"] is None else NamedUser.NamedUser(self._requester, attributes["assignee"], completed=False)
if "base" in attributes: # pragma no branch
assert attributes["base"] is None or isinstance(attributes["base"], dict), attributes["base"]
self._base = None if attributes["base"] is None else PullRequestPart.PullRequestPart(self._requester, attributes["base"], completed=False)
diff --git a/github/PullRequestComment.py b/github/PullRequestComment.py
index 04525b01..6e6eb2a6 100644
--- a/github/PullRequestComment.py
+++ b/github/PullRequestComment.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/PullRequestMergeStatus.py b/github/PullRequestMergeStatus.py
index 3117b003..ce96afac 100644
--- a/github/PullRequestMergeStatus.py
+++ b/github/PullRequestMergeStatus.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/PullRequestPart.py b/github/PullRequestPart.py
index f7695e85..0507133e 100644
--- a/github/PullRequestPart.py
+++ b/github/PullRequestPart.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/Repository.py b/github/Repository.py
index e4f98b18..b8311270 100644
--- a/github/Repository.py
+++ b/github/Repository.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
@@ -465,7 +467,7 @@ class Repository(GithubObject.GithubObject):
None
)
- def edit(self, name, description=GithubObject.NotSet, homepage=GithubObject.NotSet, public=GithubObject.NotSet, has_issues=GithubObject.NotSet, has_wiki=GithubObject.NotSet, has_downloads=GithubObject.NotSet):
+ def edit(self, name, description=GithubObject.NotSet, homepage=GithubObject.NotSet, public=GithubObject.NotSet, has_issues=GithubObject.NotSet, has_wiki=GithubObject.NotSet, has_downloads=GithubObject.NotSet, default_branch=GithubObject.NotSet):
assert isinstance(name, (str, unicode)), name
assert description is GithubObject.NotSet or isinstance(description, (str, unicode)), description
assert homepage is GithubObject.NotSet or isinstance(homepage, (str, unicode)), homepage
@@ -473,6 +475,7 @@ class Repository(GithubObject.GithubObject):
assert has_issues is GithubObject.NotSet or isinstance(has_issues, bool), has_issues
assert has_wiki is GithubObject.NotSet or isinstance(has_wiki, bool), has_wiki
assert has_downloads is GithubObject.NotSet or isinstance(has_downloads, bool), has_downloads
+ assert default_branch is GithubObject.NotSet or isinstance(default_branch, (str, unicode)), default_branch
post_parameters = {
"name": name,
}
@@ -488,6 +491,8 @@ class Repository(GithubObject.GithubObject):
post_parameters["has_wiki"] = has_wiki
if has_downloads is not GithubObject.NotSet:
post_parameters["has_downloads"] = has_downloads
+ if default_branch is not GithubObject.NotSet:
+ post_parameters["default_branch"] = default_branch
headers, data = self._requester.requestAndCheck(
"PATCH",
self.url,
diff --git a/github/RepositoryKey.py b/github/RepositoryKey.py
index e094b775..ef92ad80 100644
--- a/github/RepositoryKey.py
+++ b/github/RepositoryKey.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/Requester.py b/github/Requester.py
index 2dc08f7b..2cd8b6c7 100644
--- a/github/Requester.py
+++ b/github/Requester.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
@@ -125,7 +127,7 @@ class Requester:
requestHeaders["Authorization"] = "Basic (login and password removed)"
elif requestHeaders["Authorization"].startswith("token"):
requestHeaders["Authorization"] = "token (oauth token removed)"
- else:
+ else: # pragma no cover
requestHeaders["Authorization"] = "Unknown authorization removed"
logger.debug("%s %s://%s%s %s %s ==> %i %s %s", str(verb), self.__scheme, self.__hostname, str(url), str(requestHeaders), str(input), status, str(responseHeaders), str(output))
diff --git a/github/Tag.py b/github/Tag.py
index ab1f6fd3..b38ff6ae 100644
--- a/github/Tag.py
+++ b/github/Tag.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/Team.py b/github/Team.py
index 342ee4ce..b89a5ba8 100644
--- a/github/Team.py
+++ b/github/Team.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/UserKey.py b/github/UserKey.py
index baaacddd..ed2691af 100644
--- a/github/UserKey.py
+++ b/github/UserKey.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/__init__.py b/github/__init__.py
index 641c0ee5..269bb7bd 100644
--- a/github/__init__.py
+++ b/github/__init__.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
@@ -20,7 +22,7 @@ from InputGitAuthor import InputGitAuthor
from InputGitTreeElement import InputGitTreeElement
-def enable_console_debug_logging():
+def enable_console_debug_logging(): # pragma no cover
logger = logging.getLogger("github")
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.StreamHandler())
diff --git a/github/tests/AllTests.py b/github/tests/AllTests.py
index ab730318..33b9f840 100644
--- a/github/tests/AllTests.py
+++ b/github/tests/AllTests.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/AuthenticatedUser.py b/github/tests/AuthenticatedUser.py
index 5cfae067..19e35fc8 100644
--- a/github/tests/AuthenticatedUser.py
+++ b/github/tests/AuthenticatedUser.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
@@ -120,6 +122,10 @@ class AuthenticatedUser(Framework.TestCase):
repo = self.user.create_repo("TestPyGithub", "Repo created by PyGithub", "http://foobar.com", private=False, has_issues=False, has_wiki=False, has_downloads=False)
self.assertEqual(repo.url, "https://api.github.com/repos/jacquev6/TestPyGithub")
+ def testCreateRepositoryWithAutoInit(self):
+ repo = self.user.create_repo("TestPyGithub", auto_init=True, gitignore_template="Python")
+ self.assertEqual(repo.url, "https://api.github.com/repos/jacquev6/TestPyGithub")
+
def testCreateAuthorizationWithoutArguments(self):
authorization = self.user.create_authorization()
self.assertEqual(authorization.id, 372259)
diff --git a/github/tests/Authentication.py b/github/tests/Authentication.py
index cc8e7b06..91bb1e04 100644
--- a/github/tests/Authentication.py
+++ b/github/tests/Authentication.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/Authorization.py b/github/tests/Authorization.py
index c23f2a0c..9e79ca1c 100644
--- a/github/tests/Authorization.py
+++ b/github/tests/Authorization.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/Branch.py b/github/tests/Branch.py
index 9b84ee5b..27feeb62 100644
--- a/github/tests/Branch.py
+++ b/github/tests/Branch.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/Commit.py b/github/tests/Commit.py
index 4c242858..ac9275e0 100644
--- a/github/tests/Commit.py
+++ b/github/tests/Commit.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/CommitComment.py b/github/tests/CommitComment.py
index 83068c2b..2bead16e 100644
--- a/github/tests/CommitComment.py
+++ b/github/tests/CommitComment.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/CommitStatus.py b/github/tests/CommitStatus.py
index 49691267..2ce0e867 100644
--- a/github/tests/CommitStatus.py
+++ b/github/tests/CommitStatus.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/ContentFile.py b/github/tests/ContentFile.py
index 1616c6eb..21b85ec0 100644
--- a/github/tests/ContentFile.py
+++ b/github/tests/ContentFile.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/Download.py b/github/tests/Download.py
index 975d6f20..a24dcfd4 100644
--- a/github/tests/Download.py
+++ b/github/tests/Download.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/Enterprise.py b/github/tests/Enterprise.py
index 5552f14b..ee8f73a2 100644
--- a/github/tests/Enterprise.py
+++ b/github/tests/Enterprise.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/Event.py b/github/tests/Event.py
index 5bc0d6c7..5d518dfb 100644
--- a/github/tests/Event.py
+++ b/github/tests/Event.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/Exceptions.py b/github/tests/Exceptions.py
index b30cff58..c1a51f12 100644
--- a/github/tests/Exceptions.py
+++ b/github/tests/Exceptions.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
@@ -21,10 +23,11 @@ atLeastPython26 = sys.hexversion >= 0x02060000
class Exceptions(Framework.TestCase): # To stay compatible with Python 2.6, we do not use self.assertRaises with only one argument
def testInvalidInput(self):
+ raised = False
try:
self.g.get_user().create_key("Bad key", "xxx")
- self.fail("Should have raised")
except github.GithubException, exception:
+ raised = True
self.assertEqual(exception.status, 422)
self.assertEqual(
exception.data,
@@ -43,40 +46,47 @@ class Exceptions(Framework.TestCase): # To stay compatible with Python 2.6, we
if atLeastPython26:
self.assertEqual(str(exception), "422 {u\'message\': u\'Validation Failed\', u\'errors\': [{u\'field\': u\'key\', u\'message\': u\"key is invalid. It must begin with \'ssh-rsa\' or \'ssh-dss\'. Check that you\'re copying the public half of the key\", u\'code\': u\'custom\', u\'resource\': u\'PublicKey\'}]}")
else:
- self.assertEqual(str(exception), "422 {\'message\': \'Validation Failed\', \'errors\': [{\'field\': \'key\', \'message\': \"key is invalid. It must begin with \'ssh-rsa\' or \'ssh-dss\'. Check that you\'re copying the public half of the key\", \'code\': \'custom\', \'resource\': \'PublicKey\'}]}")
+ self.assertEqual(str(exception), "422 {\'message\': \'Validation Failed\', \'errors\': [{\'field\': \'key\', \'message\': \"key is invalid. It must begin with \'ssh-rsa\' or \'ssh-dss\'. Check that you\'re copying the public half of the key\", \'code\': \'custom\', \'resource\': \'PublicKey\'}]}") # pragma no cover
+ self.assertTrue(raised)
def testUnknownObject(self):
+ raised = False
try:
self.g.get_user().get_repo("Xxx")
- self.fail("Should have raised")
except github.GithubException, exception:
+ raised = True
self.assertEqual(exception.status, 404)
self.assertEqual(exception.data, {"message": "Not Found"})
if atLeastPython26:
self.assertEqual(str(exception), "404 {u'message': u'Not Found'}")
else:
- self.assertEqual(str(exception), "404 {'message': 'Not Found'}")
+ self.assertEqual(str(exception), "404 {'message': 'Not Found'}") # pragma no cover
+ self.assertTrue(raised)
def testUnknownUser(self):
+ raised = False
try:
self.g.get_user("ThisUserShouldReallyNotExist")
- self.fail("Should have raised")
except github.GithubException, exception:
+ raised = True
self.assertEqual(exception.status, 404)
self.assertEqual(exception.data, {"message": "Not Found"})
if atLeastPython26:
self.assertEqual(str(exception), "404 {u'message': u'Not Found'}")
else:
- self.assertEqual(str(exception), "404 {'message': 'Not Found'}")
+ self.assertEqual(str(exception), "404 {'message': 'Not Found'}") # pragma no cover
+ self.assertTrue(raised)
def testBadAuthentication(self):
+ raised = False
try:
github.Github("BadUser", "BadPassword").get_user().login
- self.fail("Should have raised")
except github.GithubException, exception:
+ raised = True
self.assertEqual(exception.status, 401)
self.assertEqual(exception.data, {"message": "Bad credentials"})
if atLeastPython26:
self.assertEqual(str(exception), "401 {u'message': u'Bad credentials'}")
else:
- self.assertEqual(str(exception), "401 {'message': 'Bad credentials'}")
+ self.assertEqual(str(exception), "401 {'message': 'Bad credentials'}") # pragma no cover
+ self.assertTrue(raised)
diff --git a/github/tests/Framework.py b/github/tests/Framework.py
index ae8c3878..b21c276c 100644
--- a/github/tests/Framework.py
+++ b/github/tests/Framework.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
@@ -39,11 +41,11 @@ def fixAuthorizationHeader(headers):
headers["Authorization"] = "token private_token_removed"
elif headers["Authorization"].startswith("Basic "):
headers["Authorization"] = "Basic login_and_password_removed"
- else:
+ else: # pragma no cover
assert False
-class RecordingConnection:
+class RecordingConnection: # pragma no cover
def __init__(self, file, protocol, host, port, *args, **kwds):
self.__file = file
self.__protocol = protocol
@@ -76,14 +78,14 @@ class RecordingConnection:
return self.__cnx.close()
-class RecordingHttpConnection(RecordingConnection):
+class RecordingHttpConnection(RecordingConnection): # pragma no cover
_realConnection = httplib.HTTPConnection
def __init__(self, file, *args, **kwds):
RecordingConnection.__init__(self, file, "http", *args, **kwds)
-class RecordingHttpsConnection(RecordingConnection):
+class RecordingHttpsConnection(RecordingConnection): # pragma no cover
_realConnection = httplib.HTTPSConnection
def __init__(self, file, *args, **kwds):
@@ -130,7 +132,7 @@ class BasicTestCase(unittest.TestCase):
unittest.TestCase.setUp(self)
self.__fileName = ""
self.__file = None
- if self.recordMode:
+ if self.recordMode: # pragma no cover
github.Requester.Requester.injectConnectionClasses(
lambda ignored, *args, **kwds: RecordingHttpConnection(self.__openFile("wb"), *args, **kwds),
lambda ignored, *args, **kwds: RecordingHttpsConnection(self.__openFile("wb"), *args, **kwds)
@@ -165,7 +167,7 @@ class BasicTestCase(unittest.TestCase):
def __closeReplayFileIfNeeded(self):
if self.__file is not None:
- if not self.recordMode:
+ if not self.recordMode: # pragma no branch
self.assertEqual(self.__file.readline(), "")
self.__file.close()
@@ -184,5 +186,5 @@ class TestCase(BasicTestCase):
self.g = github.Github(self.login, self.password)
-def activateRecordMode():
+def activateRecordMode(): # pragma no cover
BasicTestCase.recordMode = True
diff --git a/github/tests/Gist.py b/github/tests/Gist.py
index 93605532..7bf85017 100644
--- a/github/tests/Gist.py
+++ b/github/tests/Gist.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/GistComment.py b/github/tests/GistComment.py
index 08ab183d..a4d30630 100644
--- a/github/tests/GistComment.py
+++ b/github/tests/GistComment.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/GitBlob.py b/github/tests/GitBlob.py
index 92e495ae..e7896f7a 100644
--- a/github/tests/GitBlob.py
+++ b/github/tests/GitBlob.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/GitCommit.py b/github/tests/GitCommit.py
index d2d71871..fe327a4b 100644
--- a/github/tests/GitCommit.py
+++ b/github/tests/GitCommit.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/GitRef.py b/github/tests/GitRef.py
index fb2e23d1..357ca8de 100644
--- a/github/tests/GitRef.py
+++ b/github/tests/GitRef.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/GitTag.py b/github/tests/GitTag.py
index eb20977c..2a36dc42 100644
--- a/github/tests/GitTag.py
+++ b/github/tests/GitTag.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/GitTree.py b/github/tests/GitTree.py
index 7a512d8d..6ced3b3a 100644
--- a/github/tests/GitTree.py
+++ b/github/tests/GitTree.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/Github_.py b/github/tests/Github_.py
index 899b7beb..95a51b5d 100644
--- a/github/tests/Github_.py
+++ b/github/tests/Github_.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/Hook.py b/github/tests/Hook.py
index 38e114a2..403a0e4e 100644
--- a/github/tests/Hook.py
+++ b/github/tests/Hook.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/IntegrationTest.py b/github/tests/IntegrationTest.py
index a7ff3600..3fbaabb6 100755
--- a/github/tests/IntegrationTest.py
+++ b/github/tests/IntegrationTest.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
#!/bin/env python
# Copyright 2012 Vincent Jacques
diff --git a/github/tests/Issue.py b/github/tests/Issue.py
index 95eec520..7fe40498 100644
--- a/github/tests/Issue.py
+++ b/github/tests/Issue.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
@@ -95,6 +97,6 @@ class Issue(Framework.TestCase):
question = self.repo.get_label("Question")
self.assertListKeyEqual(self.issue.get_labels(), lambda l: l.name, ["Bug", "Project management", "Question"])
self.issue.delete_labels()
- self.assertListKeyEqual(self.issue.get_labels(), lambda l: l.name, [])
+ self.assertListKeyEqual(self.issue.get_labels(), None, [])
self.issue.set_labels(bug, question)
self.assertListKeyEqual(self.issue.get_labels(), lambda l: l.name, ["Bug", "Question"])
diff --git a/github/tests/Issue33.py b/github/tests/Issue33.py
index 2e29d2e1..61d8e429 100644
--- a/github/tests/Issue33.py
+++ b/github/tests/Issue33.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/Issue50.py b/github/tests/Issue50.py
index 519a2195..e4bf99df 100644
--- a/github/tests/Issue50.py
+++ b/github/tests/Issue50.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/Issue54.py b/github/tests/Issue54.py
index a8d0888a..df9b2ab0 100644
--- a/github/tests/Issue54.py
+++ b/github/tests/Issue54.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/Issue80.py b/github/tests/Issue80.py
index d5a63322..fb6643fd 100644
--- a/github/tests/Issue80.py
+++ b/github/tests/Issue80.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/Issue87.py b/github/tests/Issue87.py
index 6e777443..7edf0331 100644
--- a/github/tests/Issue87.py
+++ b/github/tests/Issue87.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/IssueComment.py b/github/tests/IssueComment.py
index 6090b4d0..53fde395 100644
--- a/github/tests/IssueComment.py
+++ b/github/tests/IssueComment.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/IssueEvent.py b/github/tests/IssueEvent.py
index 688508b8..96cb740a 100644
--- a/github/tests/IssueEvent.py
+++ b/github/tests/IssueEvent.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/Label.py b/github/tests/Label.py
index 4be91a16..3fa94ed0 100644
--- a/github/tests/Label.py
+++ b/github/tests/Label.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/Logging_.py b/github/tests/Logging_.py
index 767118f1..79cc3e34 100644
--- a/github/tests/Logging_.py
+++ b/github/tests/Logging_.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/Markdown.py b/github/tests/Markdown.py
index a9bc2dd8..ec480124 100644
--- a/github/tests/Markdown.py
+++ b/github/tests/Markdown.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/Milestone.py b/github/tests/Milestone.py
index 55446d9b..a4a17a17 100644
--- a/github/tests/Milestone.py
+++ b/github/tests/Milestone.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/NamedUser.py b/github/tests/NamedUser.py
index 90768009..5cfbdaf0 100644
--- a/github/tests/NamedUser.py
+++ b/github/tests/NamedUser.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/Organization.py b/github/tests/Organization.py
index 7610d18f..08db9120 100644
--- a/github/tests/Organization.py
+++ b/github/tests/Organization.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
@@ -111,6 +113,10 @@ class Organization(Framework.TestCase):
repo = self.org.create_repo("TestPyGithub2", "Repo created by PyGithub", "http://foobar.com", False, False, False, False, team)
self.assertEqual(repo.url, "https://api.github.com/repos/BeaverSoftware/TestPyGithub2")
+ def testCreateRepositoryWithAutoInit(self):
+ repo = self.org.create_repo("TestPyGithub", auto_init=True, gitignore_template="Python")
+ self.assertEqual(repo.url, "https://api.github.com/repos/BeaverSoftware/TestPyGithub")
+
def testCreateFork(self):
pygithub = self.g.get_user("jacquev6").get_repo("PyGithub")
repo = self.org.create_fork(pygithub)
diff --git a/github/tests/PaginatedList.py b/github/tests/PaginatedList.py
index 00c45db1..9ad4e6d5 100644
--- a/github/tests/PaginatedList.py
+++ b/github/tests/PaginatedList.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
@@ -66,7 +68,7 @@ class PaginatedList(Framework.TestCase):
def testInterruptedIteration(self):
# No asserts, but checks that only three pages are fetched
l = 0
- for element in self.list:
+ for element in self.list: # pragma no branch (exits only by break)
l += 1
if l == 75:
break
@@ -74,7 +76,7 @@ class PaginatedList(Framework.TestCase):
def testInterruptedIterationInSlice(self):
# No asserts, but checks that only three pages are fetched
l = 0
- for element in self.list[:100]:
+ for element in self.list[:100]: # pragma no branch (exits only by break)
l += 1
if l == 75:
break
diff --git a/github/tests/PullRequest.py b/github/tests/PullRequest.py
index 7afaf576..3cd42728 100644
--- a/github/tests/PullRequest.py
+++ b/github/tests/PullRequest.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
@@ -24,6 +26,7 @@ class PullRequest(Framework.TestCase):
def testAttributes(self):
self.assertEqual(self.pull.additions, 511)
+ self.assertEqual(self.pull.assignee.login, "jacquev6")
self.assertEqual(self.pull.base.label, "jacquev6:topic/RewriteWithGeneratedCode")
self.assertEqual(self.pull.base.sha, "ed866fc43833802ab553e5ff8581c81bb00dd433")
self.assertEqual(self.pull.base.user.login, "jacquev6")
@@ -32,7 +35,7 @@ class PullRequest(Framework.TestCase):
self.assertEqual(self.pull.body, "Body edited by PyGithub")
self.assertEqual(self.pull.changed_files, 45)
self.assertEqual(self.pull.closed_at, datetime.datetime(2012, 5, 27, 10, 29, 7))
- self.assertEqual(self.pull.comments, 0)
+ self.assertEqual(self.pull.comments, 1)
self.assertEqual(self.pull.commits, 3)
self.assertEqual(self.pull.created_at, datetime.datetime(2012, 5, 27, 9, 25, 36))
self.assertEqual(self.pull.deletions, 384)
@@ -41,7 +44,7 @@ class PullRequest(Framework.TestCase):
self.assertEqual(self.pull.html_url, "https://github.com/jacquev6/PyGithub/pull/31")
self.assertEqual(self.pull.id, 1436215)
self.assertEqual(self.pull.issue_url, "https://github.com/jacquev6/PyGithub/issues/31")
- self.assertEqual(self.pull.mergeable, None)
+ self.assertEqual(self.pull.mergeable, False)
self.assertEqual(self.pull.merged, True)
self.assertEqual(self.pull.merged_at, datetime.datetime(2012, 5, 27, 10, 29, 7))
self.assertEqual(self.pull.merged_by.login, "jacquev6")
@@ -50,7 +53,7 @@ class PullRequest(Framework.TestCase):
self.assertEqual(self.pull.review_comments, 1)
self.assertEqual(self.pull.state, "closed")
self.assertEqual(self.pull.title, "Title edited by PyGithub")
- self.assertEqual(self.pull.updated_at, datetime.datetime(2012, 5, 27, 10, 29, 7))
+ self.assertEqual(self.pull.updated_at, datetime.datetime(2012, 11, 3, 8, 19, 40))
self.assertEqual(self.pull.url, "https://api.github.com/repos/jacquev6/PyGithub/pulls/31")
self.assertEqual(self.pull.user.login, "jacquev6")
diff --git a/github/tests/PullRequestComment.py b/github/tests/PullRequestComment.py
index 1830f110..fae74621 100644
--- a/github/tests/PullRequestComment.py
+++ b/github/tests/PullRequestComment.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/PullRequestFile.py b/github/tests/PullRequestFile.py
index 4ebb09ed..f2ee7817 100644
--- a/github/tests/PullRequestFile.py
+++ b/github/tests/PullRequestFile.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/RateLimiting.py b/github/tests/RateLimiting.py
index 7f3c2e0b..40da9752 100644
--- a/github/tests/RateLimiting.py
+++ b/github/tests/RateLimiting.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/ReplayData/AuthenticatedUser.testCreateRepositoryWithAutoInit.txt b/github/tests/ReplayData/AuthenticatedUser.testCreateRepositoryWithAutoInit.txt
new file mode 100644
index 00000000..eddc90a5
--- /dev/null
+++ b/github/tests/ReplayData/AuthenticatedUser.testCreateRepositoryWithAutoInit.txt
@@ -0,0 +1,5 @@
+https POST api.github.com None /user/repos {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"gitignore_template": "Python", "name": "TestPyGithub", "auto_init": true}
+201
+[('status', '201 Created'), ('content-length', '1176'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('x-ratelimit-limit', '5000'), ('x-ratelimit-remaining', '4999'), ('server', 'nginx'), ('connection', 'keep-alive'), ('etag', '"762d15bfe4477f7ec15c3c08a07da857"'), ('location', 'https://api.github.com/repos/jacquev6/TestPyGithub'), ('cache-control', 'max-age=0, private, must-revalidate'), ('date', 'Sat, 03 Nov 2012 09:01:00 GMT'), ('content-type', 'application/json; charset=utf-8')]
+{"watchers":0,"pushed_at":"2012-11-03T09:00:59Z","forks":0,"has_issues":true,"has_downloads":true,"open_issues_count":0,"description":null,"html_url":"https://github.com/jacquev6/TestPyGithub","owner":{"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"url":"https://api.github.com/repos/jacquev6/TestPyGithub","updated_at":"2012-11-03T09:01:00Z","permissions":{"push":true,"pull":true,"admin":true},"mirror_url":null,"clone_url":"https://github.com/jacquev6/TestPyGithub.git","language":null,"has_wiki":true,"ssh_url":"git@github.com:jacquev6/TestPyGithub.git","svn_url":"https://github.com/jacquev6/TestPyGithub","size":0,"fork":false,"full_name":"jacquev6/TestPyGithub","open_issues":0,"git_url":"git://github.com/jacquev6/TestPyGithub.git","forks_count":0,"name":"TestPyGithub","created_at":"2012-11-03T09:00:59Z","homepage":null,"private":false,"id":6517838,"master_branch":"master","network_count":0,"watchers_count":0}
+
diff --git a/github/tests/ReplayData/Organization.testCreateRepositoryWithAutoInit.txt b/github/tests/ReplayData/Organization.testCreateRepositoryWithAutoInit.txt
new file mode 100644
index 00000000..cb71243b
--- /dev/null
+++ b/github/tests/ReplayData/Organization.testCreateRepositoryWithAutoInit.txt
@@ -0,0 +1,5 @@
+https POST api.github.com None /orgs/BeaverSoftware/repos {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"gitignore_template": "Python", "name": "TestPyGithub", "auto_init": true}
+201
+[('status', '201 Created'), ('content-length', '1559'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('x-ratelimit-limit', '5000'), ('x-ratelimit-remaining', '4996'), ('server', 'nginx'), ('connection', 'keep-alive'), ('etag', '"2f35ceac1b69bbfc8c38907877514e9d"'), ('location', 'https://api.github.com/repos/BeaverSoftware/TestPyGithub'), ('cache-control', 'max-age=0, private, must-revalidate'), ('date', 'Sat, 03 Nov 2012 09:03:49 GMT'), ('content-type', 'application/json; charset=utf-8')]
+{"watchers":0,"pushed_at":"2012-11-03T09:03:49Z","forks":0,"has_issues":true,"has_downloads":true,"open_issues_count":0,"description":null,"html_url":"https://github.com/BeaverSoftware/TestPyGithub","owner":{"avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-org-420.png","url":"https://api.github.com/users/BeaverSoftware","gravatar_id":"d563e337cac2fdc644e2aaaad1e23266","login":"BeaverSoftware","id":1424031},"url":"https://api.github.com/repos/BeaverSoftware/TestPyGithub","updated_at":"2012-11-03T09:03:49Z","organization":{"avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-org-420.png","url":"https://api.github.com/users/BeaverSoftware","gravatar_id":"d563e337cac2fdc644e2aaaad1e23266","login":"BeaverSoftware","id":1424031},"permissions":{"push":true,"pull":true,"admin":true},"mirror_url":null,"clone_url":"https://github.com/BeaverSoftware/TestPyGithub.git","language":null,"has_wiki":true,"ssh_url":"git@github.com:BeaverSoftware/TestPyGithub.git","svn_url":"https://github.com/BeaverSoftware/TestPyGithub","size":0,"fork":false,"full_name":"BeaverSoftware/TestPyGithub","open_issues":0,"git_url":"git://github.com/BeaverSoftware/TestPyGithub.git","forks_count":0,"name":"TestPyGithub","created_at":"2012-11-03T09:03:49Z","homepage":null,"private":false,"id":6517856,"master_branch":"master","network_count":0,"watchers_count":0}
+
diff --git a/github/tests/ReplayData/PullRequest.setUp.txt b/github/tests/ReplayData/PullRequest.setUp.txt
index b1473769..ac0543aa 100644
--- a/github/tests/ReplayData/PullRequest.setUp.txt
+++ b/github/tests/ReplayData/PullRequest.setUp.txt
@@ -10,6 +10,6 @@ https GET api.github.com None /repos/jacquev6/PyGithub {'Authorization': 'Basic
https GET api.github.com None /repos/jacquev6/PyGithub/pulls/31 {'Authorization': 'Basic login_and_password_removed'} null
200
-[('status', '200 OK'), ('x-ratelimit-remaining', '4948'), ('content-length', '4806'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"2ec526e3dd610dfb92cccc8159bd2585"'), ('date', 'Sun, 27 May 2012 10:32:06 GMT'), ('content-type', 'application/json; charset=utf-8')]
-{"merged":true,"mergeable":null,"_links":{"self":{"href":"https://api.github.com/repos/jacquev6/PyGithub/pulls/31"},"comments":{"href":"https://api.github.com/repos/jacquev6/PyGithub/issues/31/comments"},"issue":{"href":"https://api.github.com/repos/jacquev6/PyGithub/issues/31"},"html":{"href":"https://github.com/jacquev6/PyGithub/pull/31"},"review_comments":{"href":"https://api.github.com/repos/jacquev6/PyGithub/pulls/31/comments"}},"head":{"ref":"master","label":"BeaverSoftware:master","repo":{"clone_url":"https://github.com/BeaverSoftware/PyGithub.git","has_downloads":true,"watchers":1,"updated_at":"2012-05-27T09:09:17Z","homepage":"http://vincent-jacques.net/PyGithub","url":"https://api.github.com/repos/BeaverSoftware/PyGithub","mirror_url":null,"has_wiki":false,"has_issues":false,"fork":true,"forks":0,"git_url":"git://github.com/BeaverSoftware/PyGithub.git","size":176,"private":false,"open_issues":0,"svn_url":"https://github.com/BeaverSoftware/PyGithub","owner":{"url":"https://api.github.com/users/BeaverSoftware","avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","gravatar_id":"d563e337cac2fdc644e2aaaad1e23266","login":"BeaverSoftware","id":1424031},"name":"PyGithub","language":"Python","description":"Python library implementing the full Github API v3","ssh_url":"git@github.com:BeaverSoftware/PyGithub.git","pushed_at":"2012-05-27T09:09:17Z","created_at":"2012-05-27T08:50:04Z","id":4460787,"html_url":"https://github.com/BeaverSoftware/PyGithub","full_name":"BeaverSoftware/PyGithub"},"user":{"url":"https://api.github.com/users/BeaverSoftware","avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","gravatar_id":"d563e337cac2fdc644e2aaaad1e23266","login":"BeaverSoftware","id":1424031},"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},"updated_at":"2012-05-27T10:29:07Z","issue_url":"https://github.com/jacquev6/PyGithub/issues/31","changed_files":45,"body":"Body edited by PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub/pulls/31","comments":0,"base":{"ref":"topic/RewriteWithGeneratedCode","label":"jacquev6:topic/RewriteWithGeneratedCode","repo":{"clone_url":"https://github.com/jacquev6/PyGithub.git","has_downloads":true,"watchers":15,"updated_at":"2012-05-27T10:29:10Z","homepage":"http://vincent-jacques.net/PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub","mirror_url":null,"has_wiki":false,"has_issues":true,"fork":false,"forks":3,"git_url":"git://github.com/jacquev6/PyGithub.git","size":188,"private":false,"open_issues":16,"svn_url":"https://github.com/jacquev6/PyGithub","owner":{"url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"name":"PyGithub","language":"Python","description":"Python library implementing the full Github API v3","ssh_url":"git@github.com:jacquev6/PyGithub.git","pushed_at":"2012-05-27T10:29:09Z","created_at":"2012-02-25T12:53:47Z","id":3544490,"html_url":"https://github.com/jacquev6/PyGithub","full_name":"jacquev6/PyGithub"},"user":{"url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"sha":"ed866fc43833802ab553e5ff8581c81bb00dd433"},"number":31,"diff_url":"https://github.com/jacquev6/PyGithub/pull/31.diff","merged_by":{"url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"closed_at":"2012-05-27T10:29:07Z","title":"Title edited by PyGithub","deletions":384,"merged_at":"2012-05-27T10:29:07Z","patch_url":"https://github.com/jacquev6/PyGithub/pull/31.patch","additions":511,"created_at":"2012-05-27T09:25:36Z","user":{"url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"state":"closed","id":1436215,"review_comments":1,"commits":3,"html_url":"https://github.com/jacquev6/PyGithub/pull/31"}
+[('status', '200 OK'), ('x-ratelimit-remaining', '4985'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('x-ratelimit-limit', '5000'), ('vary', 'Accept, Authorization, Cookie'), ('content-length', '4182'), ('server', 'nginx'), ('last-modified', 'Sat, 03 Nov 2012 08:19:40 GMT'), ('connection', 'keep-alive'), ('etag', '"1ec7d9f2ebb27db7dc002f1382d23975"'), ('cache-control', 'private, s-maxage=60, max-age=60'), ('date', 'Sat, 03 Nov 2012 08:19:46 GMT'), ('content-type', 'application/json; charset=utf-8')]
+{"additions":511,"deletions":384,"merged_at":"2012-05-27T10:29:07Z","base":{"label":"jacquev6:topic/RewriteWithGeneratedCode","repo":{"watchers":97,"pushed_at":"2012-11-03T08:07:38Z","watchers_count":97,"forks":27,"open_issues":12,"mirror_url":null,"description":"Python library implementing the full Github API v3","owner":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","login":"jacquev6","id":327146},"open_issues_count":12,"url":"https://api.github.com/repos/jacquev6/PyGithub","updated_at":"2012-11-03T08:07:40Z","html_url":"https://github.com/jacquev6/PyGithub","clone_url":"https://github.com/jacquev6/PyGithub.git","language":"Python","has_downloads":true,"ssh_url":"git@github.com:jacquev6/PyGithub.git","size":256,"forks_count":27,"fork":false,"full_name":"jacquev6/PyGithub","name":"PyGithub","created_at":"2012-02-25T12:53:47Z","git_url":"git://github.com/jacquev6/PyGithub.git","svn_url":"https://github.com/jacquev6/PyGithub","homepage":"http://vincent-jacques.net/PyGithub","has_wiki":true,"private":false,"id":3544490,"has_issues":true},"sha":"ed866fc43833802ab553e5ff8581c81bb00dd433","ref":"topic/RewriteWithGeneratedCode","user":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","login":"jacquev6","id":327146}},"review_comments":1,"changed_files":45,"merge_commit_sha":"28ae6dd10ebccd5eaf8db8dacb5b699ee7f4a663","closed_at":"2012-05-27T10:29:07Z","number":31,"issue_url":"https://github.com/jacquev6/PyGithub/issues/31","url":"https://api.github.com/repos/jacquev6/PyGithub/pulls/31","milestone":null,"updated_at":"2012-11-03T08:19:40Z","patch_url":"https://github.com/jacquev6/PyGithub/pull/31.patch","html_url":"https://github.com/jacquev6/PyGithub/pull/31","merged_by":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","login":"jacquev6","id":327146},"commits":3,"state":"closed","mergeable":false,"_links":{"review_comments":{"href":"https://api.github.com/repos/jacquev6/PyGithub/pulls/31/comments"},"html":{"href":"https://github.com/jacquev6/PyGithub/pull/31"},"self":{"href":"https://api.github.com/repos/jacquev6/PyGithub/pulls/31"},"issue":{"href":"https://api.github.com/repos/jacquev6/PyGithub/issues/31"},"comments":{"href":"https://api.github.com/repos/jacquev6/PyGithub/issues/31/comments"}},"head":{"label":"BeaverSoftware:master","repo":null,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","ref":"master","user":{"url":"https://api.github.com/users/BeaverSoftware","gravatar_id":"d563e337cac2fdc644e2aaaad1e23266","avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-org-420.png","login":"BeaverSoftware","id":1424031}},"assignee":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","login":"jacquev6","id":327146},"diff_url":"https://github.com/jacquev6/PyGithub/pull/31.diff","comments":1,"created_at":"2012-05-27T09:25:36Z","id":1436215,"merged":true,"mergeable_state":"dirty","body":"Body edited by PyGithub","user":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","login":"jacquev6","id":327146},"title":"Title edited by PyGithub"}
diff --git a/github/tests/ReplayData/Repository.testEditWithDefaultBranch.txt b/github/tests/ReplayData/Repository.testEditWithDefaultBranch.txt
new file mode 100644
index 00000000..81524825
--- /dev/null
+++ b/github/tests/ReplayData/Repository.testEditWithDefaultBranch.txt
@@ -0,0 +1,5 @@
+https PATCH api.github.com None /repos/jacquev6/PyGithub {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"default_branch": "master", "name": "PyGithub"}
+200
+[('status', '200 OK'), ('content-length', '1264'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('x-ratelimit-remaining', '4971'), ('server', 'nginx'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"4493662efd70c37f486a910d29ef99c1"'), ('cache-control', 'max-age=0, private, must-revalidate'), ('date', 'Sat, 03 Nov 2012 08:41:07 GMT'), ('content-type', 'application/json; charset=utf-8')]
+{"master_branch":"master","watchers":97,"pushed_at":"2012-11-03T08:25:58Z","watchers_count":97,"forks":27,"svn_url":"https://github.com/jacquev6/PyGithub","description":"Python library implementing the full Github API v3","owner":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","login":"jacquev6","id":327146},"open_issues":11,"open_issues_count":11,"url":"https://api.github.com/repos/jacquev6/PyGithub","updated_at":"2012-11-03T08:41:07Z","permissions":{"push":true,"pull":true,"admin":true},"default_branch":"master","html_url":"https://github.com/jacquev6/PyGithub","clone_url":"https://github.com/jacquev6/PyGithub.git","language":"Python","has_downloads":true,"ssh_url":"git@github.com:jacquev6/PyGithub.git","size":256,"mirror_url":null,"fork":false,"full_name":"jacquev6/PyGithub","forks_count":27,"name":"PyGithub","created_at":"2012-02-25T12:53:47Z","git_url":"git://github.com/jacquev6/PyGithub.git","homepage":"http://vincent-jacques.net/PyGithub","has_issues":true,"private":false,"id":3544490,"network_count":27,"has_wiki":true}
+
diff --git a/github/tests/Repository.py b/github/tests/Repository.py
index b2833109..578b6106 100644
--- a/github/tests/Repository.py
+++ b/github/tests/Repository.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
@@ -65,6 +67,11 @@ class Repository(Framework.TestCase):
self.repo.edit("PyGithub", "Python library implementing the full Github API v3")
self.assertEqual(self.repo.description, "Python library implementing the full Github API v3")
+ def testEditWithDefaultBranch(self):
+ self.assertEqual(self.repo.master_branch, None)
+ self.repo.edit("PyGithub", default_branch="master")
+ self.assertEqual(self.repo.master_branch, "master")
+
def testDelete(self):
repo = self.g.get_user().get_repo("TestPyGithub")
repo.delete()
@@ -409,9 +416,11 @@ class Repository(Framework.TestCase):
self.assertEqual(commit, None)
def testMergeWithConflict(self):
+ raised = False
try:
commit = self.repo.merge("branchForBase", "branchForHead")
- self.fail("Should have raised")
except github.GithubException, exception:
+ raised = True
self.assertEqual(exception.status, 409)
self.assertEqual(exception.data, {"message": "Merge conflict"})
+ self.assertTrue(raised)
diff --git a/github/tests/RepositoryKey.py b/github/tests/RepositoryKey.py
index bfc82936..1072d71a 100644
--- a/github/tests/RepositoryKey.py
+++ b/github/tests/RepositoryKey.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/Tag.py b/github/tests/Tag.py
index 9421d343..86ecf627 100644
--- a/github/tests/Tag.py
+++ b/github/tests/Tag.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/Team.py b/github/tests/Team.py
index c2469886..dae05bae 100644
--- a/github/tests/Team.py
+++ b/github/tests/Team.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
@@ -30,24 +32,24 @@ class Team(Framework.TestCase):
def testMembers(self):
user = self.g.get_user("jacquev6")
- self.assertListKeyEqual(self.team.get_members(), lambda u: u.login, [])
+ self.assertListKeyEqual(self.team.get_members(), None, [])
self.assertFalse(self.team.has_in_members(user))
self.team.add_to_members(user)
self.assertListKeyEqual(self.team.get_members(), lambda u: u.login, ["jacquev6"])
self.assertTrue(self.team.has_in_members(user))
self.team.remove_from_members(user)
- self.assertListKeyEqual(self.team.get_members(), lambda u: u.login, [])
+ self.assertListKeyEqual(self.team.get_members(), None, [])
self.assertFalse(self.team.has_in_members(user))
def testRepos(self):
repo = self.org.get_repo("FatherBeaver")
- self.assertListKeyEqual(self.team.get_repos(), lambda r: r.name, [])
+ self.assertListKeyEqual(self.team.get_repos(), None, [])
self.assertFalse(self.team.has_in_repos(repo))
self.team.add_to_repos(repo)
self.assertListKeyEqual(self.team.get_repos(), lambda r: r.name, ["FatherBeaver"])
self.assertTrue(self.team.has_in_repos(repo))
self.team.remove_from_repos(repo)
- self.assertListKeyEqual(self.team.get_repos(), lambda r: r.name, [])
+ self.assertListKeyEqual(self.team.get_repos(), None, [])
self.assertFalse(self.team.has_in_repos(repo))
def testEditWithoutArguments(self):
diff --git a/github/tests/UserKey.py b/github/tests/UserKey.py
index 6b4306b5..14a59240 100644
--- a/github/tests/UserKey.py
+++ b/github/tests/UserKey.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
diff --git a/github/tests/__init__.py b/github/tests/__init__.py
index 8108507e..cf725e9e 100644
--- a/github/tests/__init__.py
+++ b/github/tests/__init__.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
@@ -11,10 +13,20 @@
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see .
-import unittest
+import sys
+
+atLeastPython27 = sys.hexversion >= 0x02070000
+
+if atLeastPython27:
+ import unittest
+else: # pragma no cover
+ import unittest2 as unittest # pragma no cover
import AllTests
def run():
- unittest.main(module=AllTests, argv=["Dummy Script Name"])
+ testLoader = unittest.loader.TestLoader()
+ testRunner = unittest.runner.TextTestRunner(verbosity=1)
+ test = testLoader.loadTestsFromModule(AllTests)
+ return testRunner.run(test)
diff --git a/github/tests/__main__.py b/github/tests/__main__.py
index 802c3f69..5ab5ad74 100644
--- a/github/tests/__main__.py
+++ b/github/tests/__main__.py
@@ -1,3 +1,18 @@
+# -*- coding: utf-8 -*-
+
+# 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 sys
import unittest
diff --git a/publish.sh b/publish.sh
index 5fb0cdd7..23cef761 100755
--- a/publish.sh
+++ b/publish.sh
@@ -1,4 +1,5 @@
#!/bin/sh
+# -*- coding: utf-8 -*-
pep8 --ignore=E501 github # pip install pep8
python setup.py test
diff --git a/python25-requirements.txt b/python25-requirements.txt
index 7693e645..609f9122 100644
--- a/python25-requirements.txt
+++ b/python25-requirements.txt
@@ -1 +1,2 @@
simplejson
+unittest2
diff --git a/python26-requirements.txt b/python26-requirements.txt
new file mode 100644
index 00000000..9a23970d
--- /dev/null
+++ b/python26-requirements.txt
@@ -0,0 +1 @@
+unittest2
diff --git a/setup.py b/setup.py
index db1f1232..eebba39f 100755
--- a/setup.py
+++ b/setup.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+# -*- coding: utf-8 -*-
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
@@ -15,6 +16,8 @@
from distutils.core import setup, Command
import textwrap
+import sys
+import glob
class test( Command ):
user_options = []
@@ -26,8 +29,27 @@ class test( Command ):
pass
def run( self ):
+ try:
+ import coverage
+ analyseCoverage = True
+ except ImportError:
+ print "Unable to import coverage. Running tests without coverage analysis"
+ analyseCoverage = False
+ if analyseCoverage:
+ cov = coverage.coverage(branch=True)
+ cov.start()
+
import github.tests
- github.tests.run()
+ ok = github.tests.run().wasSuccessful()
+ if analyseCoverage:
+ cov.stop()
+ for f in glob.glob( "github/*.py" ):
+ ok = ok and len( cov.analysis2( f )[ 3 ] ) == 0
+ cov.report(file=sys.stdout, include="github/*")
+ if ok:
+ exit( 0 )
+ else:
+ exit( 1 )
setup(
name = "PyGithub",