Follow pep8

This commit is contained in:
Vincent Jacques
2012-09-25 23:13:13 +02:00
parent a13ce33beb
commit 431d9701d7
4 changed files with 12 additions and 11 deletions
+1
View File
@@ -19,6 +19,7 @@ from InputFileContent import InputFileContent
from InputGitAuthor import InputGitAuthor
from InputGitTreeElement import InputGitTreeElement
def enable_console_debug_logging():
logger = logging.getLogger("github")
logger.setLevel(logging.DEBUG)
+1 -1
View File
@@ -30,7 +30,7 @@ class Gist(Framework.TestCase):
self.assertEquals(self.gist.files["fail_github.py"].size, 1636)
self.assertEquals(self.gist.files["fail_github.py"].filename, "fail_github.py")
self.assertEquals(self.gist.files["fail_github.py"].language, "Python")
self.assertEquals(self.gist.files["fail_github.py"].content, 'import httplib\nimport base64\nimport json\n\nlogin = ""\npassword = ""\norgName = ""\nrepoName = "FailGithubApi"\n\ndef doRequest( verb, url, input ):\n input = json.dumps( input )\n cnx = httplib.HTTPSConnection( "api.github.com", strict = True )\n cnx.request( verb, url, input, { "Authorization" : "Basic " + base64.b64encode( login + ":" + password ).replace( \'\\n\', \'\' ) } )\n response = cnx.getresponse()\n status = response.status\n output = response.read()\n cnx.close()\n print verb, url, input, "=>", status, output\n print\n if status < 200 or status >= 300:\n exit( 1 )\n return json.loads( output )\n\n# Create a repo\ndoRequest( "POST", "/user/repos", { "name": repoName } )\n\n# Create a blob, a tree, a commit and the master branch\nb = doRequest(\n "POST", "/repos/%s/%s/git/blobs" % ( login, repoName ),\n { "content": "Content of the blob", "encoding": "latin1" }\n)\nt = doRequest(\n "POST", "/repos/%s/%s/git/trees" % ( login, repoName ),\n { "tree" : [ { "path": "foo.bar", "type": "blob", "mode": "100644", "sha": b["sha"] } ] }\n)\nc = doRequest(\n "POST", "/repos/%s/%s/git/commits" % ( login, repoName ),\n { "parents": [], "message": "Message of the commit", "tree": t["sha"] }\n)\ndoRequest(\n "POST", "/repos/%s/%s/git/refs" % ( login, repoName ),\n { "ref": "refs/heads/master", "sha": c["sha"] }\n)\n\n# Fork the repo\ndoRequest( "POST", "/repos/%s/%s/forks?org=%s" % ( login, repoName, orgName ), None )\n\n# Create a new blob => BOOM error 500\ndoRequest(\n "POST", "/repos/%s/%s/git/blobs" % ( orgName, repoName ),\n { "content": "Content of the new blob", "encoding": "latin1" }\n)\n' )
self.assertEquals(self.gist.files["fail_github.py"].content, 'import httplib\nimport base64\nimport json\n\nlogin = ""\npassword = ""\norgName = ""\nrepoName = "FailGithubApi"\n\ndef doRequest( verb, url, input ):\n input = json.dumps( input )\n cnx = httplib.HTTPSConnection( "api.github.com", strict = True )\n cnx.request( verb, url, input, { "Authorization" : "Basic " + base64.b64encode( login + ":" + password ).replace( \'\\n\', \'\' ) } )\n response = cnx.getresponse()\n status = response.status\n output = response.read()\n cnx.close()\n print verb, url, input, "=>", status, output\n print\n if status < 200 or status >= 300:\n exit( 1 )\n return json.loads( output )\n\n# Create a repo\ndoRequest( "POST", "/user/repos", { "name": repoName } )\n\n# Create a blob, a tree, a commit and the master branch\nb = doRequest(\n "POST", "/repos/%s/%s/git/blobs" % ( login, repoName ),\n { "content": "Content of the blob", "encoding": "latin1" }\n)\nt = doRequest(\n "POST", "/repos/%s/%s/git/trees" % ( login, repoName ),\n { "tree" : [ { "path": "foo.bar", "type": "blob", "mode": "100644", "sha": b["sha"] } ] }\n)\nc = doRequest(\n "POST", "/repos/%s/%s/git/commits" % ( login, repoName ),\n { "parents": [], "message": "Message of the commit", "tree": t["sha"] }\n)\ndoRequest(\n "POST", "/repos/%s/%s/git/refs" % ( login, repoName ),\n { "ref": "refs/heads/master", "sha": c["sha"] }\n)\n\n# Fork the repo\ndoRequest( "POST", "/repos/%s/%s/forks?org=%s" % ( login, repoName, orgName ), None )\n\n# Create a new blob => BOOM error 500\ndoRequest(\n "POST", "/repos/%s/%s/git/blobs" % ( orgName, repoName ),\n { "content": "Content of the new blob", "encoding": "latin1" }\n)\n')
self.assertEquals(self.gist.files["fail_github.py"].raw_url, "https://gist.github.com/raw/2729810/2fb3aa84e0efa50dc0f4c18b5df5b7b9ab27076b/fail_github.py")
self.assertEquals(self.gist.forks, [])
self.assertEquals(self.gist.git_pull_url, "git://gist.github.com/2729810.git")
+8 -8
View File
@@ -22,17 +22,17 @@ class Issue87(Framework.TestCase): # https://github.com/jacquev6/PyGithub/issue
self.repo = self.g.get_user().get_repo("PyGithub")
def testCreateIssueWithPercentInTitle(self):
issue = self.repo.create_issue( "Issue with percent % in title created by PyGithub" )
self.assertEqual( issue.number, 99 )
issue = self.repo.create_issue("Issue with percent % in title created by PyGithub")
self.assertEqual(issue.number, 99)
def testCreateIssueWithPercentInBody(self):
issue = self.repo.create_issue( "Issue created by PyGithub", "Percent % in body" )
self.assertEqual( issue.number, 98 )
issue = self.repo.create_issue("Issue created by PyGithub", "Percent % in body")
self.assertEqual(issue.number, 98)
def testCreateIssueWithEscapedPercentInTitle(self):
issue = self.repo.create_issue( "Issue with escaped percent %25 in title created by PyGithub" )
self.assertEqual( issue.number, 97 )
issue = self.repo.create_issue("Issue with escaped percent %25 in title created by PyGithub")
self.assertEqual(issue.number, 97)
def testCreateIssueWithEscapedPercentInBody(self):
issue = self.repo.create_issue( "Issue created by PyGithub", "Escaped percent %25 in body" )
self.assertEqual( issue.number, 96 )
issue = self.repo.create_issue("Issue created by PyGithub", "Escaped percent %25 in body")
self.assertEqual(issue.number, 96)
+2 -2
View File
@@ -27,7 +27,7 @@ class Logging(Framework.BasicTestCase):
def handle(self, record):
self.handled = record.getMessage()
def setUp( self ):
def setUp(self):
Framework.BasicTestCase.setUp(self)
logger = logging.getLogger("github")
logger.setLevel(logging.DEBUG)
@@ -48,5 +48,5 @@ class Logging(Framework.BasicTestCase):
def testLoggingWithBaseUrl(self):
# ReplayData forged, not recorded
self.assertEqual(github.Github(base_url = "http://my.enterprise.com/my/prefix").get_user("jacquev6").name, "Vincent Jacques")
self.assertEqual(github.Github(base_url="http://my.enterprise.com/my/prefix").get_user("jacquev6").name, "Vincent Jacques")
self.assertEqual(self.__handler.handled, u'GET http://my.enterprise.com/my/prefix/users/jacquev6 {} None ==> 200 {\'status\': \'200 OK\', \'content-length\': \'628\', \'x-github-media-type\': \'github.beta; format=json\', \'x-content-type-options\': \'nosniff\', \'vary\': \'Accept\', \'x-ratelimit-remaining\': \'4989\', \'server\': \'nginx\', \'last-modified\': \'Tue, 25 Sep 2012 07:42:42 GMT\', \'connection\': \'keep-alive\', \'x-ratelimit-limit\': \'5000\', \'etag\': \'"9bd085221a16b6d2ea95e72634c3c1ac"\', \'cache-control\': \'public, max-age=60, s-maxage=60\', \'date\': \'Tue, 25 Sep 2012 20:38:56 GMT\', \'content-type\': \'application/json; charset=utf-8\'} {"type":"User","html_url":"https://github.com/jacquev6","login":"jacquev6","followers":14,"company":"Criteo","created_at":"2010-07-09T06:10:06Z","email":"vincent@vincent-jacques.net","hireable":false,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","public_gists":3,"bio":"","following":29,"name":"Vincent Jacques","blog":"http://vincent-jacques.net","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","id":327146,"public_repos":13,"location":"Paris, France","url":"https://api.github.com/users/jacquev6"}')