Mercurial > repos > bcclaywell > argo_navis
comparison venv/lib/python2.7/site-packages/github/tests/Commit.py @ 0:d67268158946 draft
planemo upload commit a3f181f5f126803c654b3a66dd4e83a48f7e203b
author | bcclaywell |
---|---|
date | Mon, 12 Oct 2015 17:43:33 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:d67268158946 |
---|---|
1 # -*- coding: utf-8 -*- | |
2 | |
3 # ########################## Copyrights and license ############################ | |
4 # # | |
5 # Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> # | |
6 # Copyright 2012 Zearin <zearin@gonk.net> # | |
7 # Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> # | |
8 # # | |
9 # This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ # | |
10 # # | |
11 # PyGithub is free software: you can redistribute it and/or modify it under # | |
12 # the terms of the GNU Lesser General Public License as published by the Free # | |
13 # Software Foundation, either version 3 of the License, or (at your option) # | |
14 # any later version. # | |
15 # # | |
16 # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY # | |
17 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # | |
18 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # | |
19 # details. # | |
20 # # | |
21 # You should have received a copy of the GNU Lesser General Public License # | |
22 # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. # | |
23 # # | |
24 # ############################################################################## | |
25 | |
26 import Framework | |
27 | |
28 | |
29 class Commit(Framework.TestCase): | |
30 def setUp(self): | |
31 Framework.TestCase.setUp(self) | |
32 self.commit = self.g.get_user().get_repo("PyGithub").get_commit("1292bf0e22c796e91cc3d6e24b544aece8c21f2a") | |
33 self.commit.author.login # to force lazy completion | |
34 | |
35 def testAttributes(self): | |
36 self.assertEqual(self.commit.author.login, "jacquev6") | |
37 self.assertEqual(self.commit.commit.url, "https://api.github.com/repos/jacquev6/PyGithub/git/commits/1292bf0e22c796e91cc3d6e24b544aece8c21f2a") | |
38 self.assertEqual(self.commit.committer.login, "jacquev6") | |
39 self.assertEqual(len(self.commit.files), 1) | |
40 self.assertEqual(self.commit.files[0].additions, 0) | |
41 self.assertEqual(self.commit.files[0].blob_url, "https://github.com/jacquev6/PyGithub/blob/1292bf0e22c796e91cc3d6e24b544aece8c21f2a/github/GithubObjects/GitAuthor.py") | |
42 self.assertEqual(self.commit.files[0].changes, 20) | |
43 self.assertEqual(self.commit.files[0].deletions, 20) | |
44 self.assertEqual(self.commit.files[0].filename, "github/GithubObjects/GitAuthor.py") | |
45 self.assertTrue(isinstance(self.commit.files[0].patch, (str, unicode))) | |
46 self.assertEqual(self.commit.files[0].raw_url, "https://github.com/jacquev6/PyGithub/raw/1292bf0e22c796e91cc3d6e24b544aece8c21f2a/github/GithubObjects/GitAuthor.py") | |
47 self.assertEqual(self.commit.files[0].sha, "1292bf0e22c796e91cc3d6e24b544aece8c21f2a") | |
48 self.assertEqual(self.commit.files[0].status, "modified") | |
49 self.assertEqual(len(self.commit.parents), 1) | |
50 self.assertEqual(self.commit.parents[0].sha, "b46ed0dfde5ad02d3b91eb54a41c5ed960710eae") | |
51 self.assertEqual(self.commit.sha, "1292bf0e22c796e91cc3d6e24b544aece8c21f2a") | |
52 self.assertEqual(self.commit.stats.deletions, 20) | |
53 self.assertEqual(self.commit.stats.additions, 0) | |
54 self.assertEqual(self.commit.stats.total, 20) | |
55 self.assertEqual(self.commit.url, "https://api.github.com/repos/jacquev6/PyGithub/commits/1292bf0e22c796e91cc3d6e24b544aece8c21f2a") | |
56 | |
57 def testGetComments(self): | |
58 self.assertListKeyEqual(self.commit.get_comments(), lambda c: c.id, [1347033, 1347083, 1347397, 1349654]) | |
59 | |
60 def testCreateComment(self): | |
61 comment = self.commit.create_comment("Comment created by PyGithub") | |
62 self.assertEqual(comment.id, 1361949) | |
63 self.assertEqual(comment.line, None) | |
64 self.assertEqual(comment.path, None) | |
65 self.assertEqual(comment.position, None) | |
66 | |
67 def testCreateCommentOnFileLine(self): | |
68 comment = self.commit.create_comment("Comment created by PyGithub", path="codegen/templates/GithubObject.MethodBody.UseResult.py", line=26) | |
69 self.assertEqual(comment.id, 1362000) | |
70 self.assertEqual(comment.line, 26) | |
71 self.assertEqual(comment.path, "codegen/templates/GithubObject.MethodBody.UseResult.py") | |
72 self.assertEqual(comment.position, None) | |
73 | |
74 def testCreateCommentOnFilePosition(self): | |
75 comment = self.commit.create_comment("Comment also created by PyGithub", path="codegen/templates/GithubObject.MethodBody.UseResult.py", position=3) | |
76 self.assertEqual(comment.id, 1362001) | |
77 self.assertEqual(comment.line, None) | |
78 self.assertEqual(comment.path, "codegen/templates/GithubObject.MethodBody.UseResult.py") | |
79 self.assertEqual(comment.position, 3) | |
80 | |
81 def testCreateStatusWithoutOptionalParameters(self): | |
82 status = self.commit.create_status("pending") | |
83 self.assertEqual(status.id, 277031) | |
84 self.assertEqual(status.state, "pending") | |
85 self.assertEqual(status.target_url, None) | |
86 self.assertEqual(status.description, None) | |
87 | |
88 def testCreateStatusWithAllParameters(self): | |
89 status = self.commit.create_status("success", "https://github.com/jacquev6/PyGithub/issues/67", "Status successfuly created by PyGithub") | |
90 self.assertEqual(status.id, 277040) | |
91 self.assertEqual(status.state, "success") | |
92 self.assertEqual(status.target_url, "https://github.com/jacquev6/PyGithub/issues/67") | |
93 self.assertEqual(status.description, "Status successfuly created by PyGithub") |