forked from ask/python-github2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_commits.py
More file actions
48 lines (38 loc) · 1.78 KB
/
Copy pathtest_commits.py
File metadata and controls
48 lines (38 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import _setup
from nose.tools import assert_equals
import utils
class Commit(utils.HttpMockTestCase):
def test_repr(self):
commit_id = '1c83cde9b5a7c396a01af1007fb7b88765b9ae45'
commit = self.client.commits.show('ask/python-github2', commit_id)
assert_equals(repr(commit),
'<Commit: %s Added cache suppo...>' % commit_id[:8])
class CommitsQueries(utils.HttpMockTestCase):
"""Test commit querying"""
def test_list(self):
commits = self.client.commits.list('JNRowe/misc-overlay')
assert_equals(len(commits), 35)
assert_equals(commits[0].id,
'4de0834d58b37ef3020c49df43c95649217a2def')
def test_list_with_page(self):
commits = self.client.commits.list('JNRowe/jnrowe-misc', page=2)
assert_equals(len(commits), 35)
assert_equals(commits[0].id,
'1f5ad2c3206bafc4aca9e6ce50f5c605befdb3d6')
def test_list_with_branch(self):
commits = self.client.commits.list('JNRowe/misc-overlay', 'gh-pages')
assert_equals(len(commits), 35)
assert_equals(commits[0].id,
'025148bdaa6fb6bdac9c3522d481fadf1c0a456f')
def test_list_with_file(self):
commits = self.client.commits.list('JNRowe/misc-overlay',
file='Makefile')
assert_equals(len(commits), 35)
assert_equals(commits[0].id,
'fc12b924d34dc38c8ce76d27a866221faa88cb72')
def test_list_with_branch_and_file(self):
commits = self.client.commits.list('JNRowe/misc-overlay', 'gh-pages',
'packages/dev-python.html')
assert_equals(len(commits), 35)
assert_equals(commits[0].id,
'025148bdaa6fb6bdac9c3522d481fadf1c0a456f')