8000 Initial commit of migrating test_git.py to unit/test_git.py · pythonthings/github3.py@2b9eb47 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2b9eb47

Browse files
Initial commit of migrating test_git.py to unit/test_git.py
In order to call self.instance.recurse(), we need to add an integration test. After, we can then remove the class TestTree completely
1 parent dfbab2e commit 2b9eb47

File tree

2 files changed

+168
-0
lines changed

2 files changed

+168
-0
lines changed

tests/unit/test_git.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import github3
2+
3+
from .helper import (UnitHelper, create_example_data_helper, create_url_helper)
4+
5+
get_example_data = create_example_data_helper('tree_example')
6+
url_for = create_url_helper('https://api.github.com/repos/sigmavirus24/github3.py/'
7+
'git/trees/75b347329e3fc87ac78895ca1be58daff78872a1')
8+
9+
10+
class TestTree(UnitHelper):
11+
"""Tree unit test"""
12+
13+
described_class = github3.git.Tree
14+
example_data = get_example_data()
15+
16+
def test_repr(self):
17+
"""Assert Tree in in the repr."""
18+
assert isinstance(self.instance, github3.git.Tree)
19+
assert repr(self.instance).startswith('<Tree')
20+
21+
def test_recurse(self):
22+
"""Assert that URL is called"""
23+
self.instance.recurse()
24+
self.session.get.assert_called_once_with(
25+
url_for(),
26+
params={u'recursive': u'1'}
27+
)

tests/unit/tree_example

Lines changed: 141 additions & 0 deletions
< 8000 /tr>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
{
2+
"sha": "75b347329e3fc87ac78895ca1be58daff78872a1",
3+
"tree": [
4+
{
5+
"mode": "100644",
6+
"path": "__init__.py",
7+
"sha": "4b80ea07585ce06c2ce9457dc672cc56ee595627",
8+
"size": 471,
9+
"type": "blob",
10+
"url": "https://api.github.com/repos/sigmavirus24/github3.py/git/blobs/4b80ea07585ce06c2ce9457dc672cc56ee595627"
11+
},
12+
{
13+
"mode": "100644",
14+
"path": "api.py",
15+
"sha": "48878ac761879373c1c9c9ebaf6d3a4fc59a1aaf",
16+
"size": 11539,
17+
"type": "blob",
18+
"url": "https://api.github.com/repos/sigmavirus24/github3.py/git/blobs/48878ac761879373c1c9c9ebaf6d3a4fc59a1aaf"
19+
},
20+
{
21+
"mode": "100644",
22+
"path": "auths.py",
23+
"sha": "21bf5675371228c22b9e957240542ff5866ef3c8",
24+
"size": 3179,
25+
"type": "blob",
26+
"url": "https://api.github.com/repos/sigmavirus24/github3.py/git/blobs/21bf5675371228c22b9e957240542ff5866ef3c8"
27+
},
28+
{
29+
"mode": "100644",
30+
"path": "decorators.py",
31+
"sha": "95cc275caf320b3ee7ae57a14ef574d410a57559",
32+
"size": 2050,
33+
"type": "blob",
34+
"url": "https://api.github.com/repos/sigmavirus24/github3.py/git/blobs/95cc275caf320b3ee7ae57a14ef574d410a57559"
35+
},
36+
{
37+
"mode": "100644",
38+
"path": "events.py",
39+
"sha": "134b391ddc4ea3a1c569c6944e4813c34fcface4",
40+
"size": 4852,
41+
"type": "blob",
42+
"url": "https://api.github.com/repos/sigmavirus24/github3.py/git/blobs/134b391ddc4ea3a1c569c6944e4813c34fcface4"
43+
},
44+
{
45+
"mode": "100644",
46+
"path": "gists.py",
47+
"sha": "4e7ba7a5c61ff4ff0cc6b19c4f0d31da49d3cfc5",
48+
"size": 9173,
49+
"type": "blob",
50+
"url": "https://api.github.com/repos/sigmavirus24/github3.py/git/blobs/4e7ba7a5c61ff4ff0cc6b19c4f0d31da49d3cfc5"
51+
},
52+
{
53+
"mode": "100644",
54+
"path": "git.py",
55+
"sha": "1e85dda0861c8264b591d53613a415e389c56dee",
56+
"size": 6388,
57+
"type": "blob",
58+
"url": "https://api.github.com/repos/sigmavirus24/github3.py/git/blobs/1e85dda0861c8264b591d53613a415e389c56dee"
59+
},
60+
{
61+
"mode": "100644",
62+
"path": "github.py",
63+
"sha": "ddbe2d0f105b5bf138e6b9d224517b503b73d916",
64+
"size": 38859,
65+
"type": "blob",
66+
"url": "https://api.github.com/repos/sigmavirus24/github3.py/git/blobs/ddbe2d0f105b5bf138e6b9d224517b503b73d916"
67+
},
68+
{
69+
"mode": "100644",
70+
"path": "issues.py",
71+
"sha": "1602a5f936d531392f64e40c26e152dacc0b477f",
72+
"size": 17049,
73+
"type": "blob",
74+
"url": "https://api.github.com/repos/sigmavirus24/github3.py/git/blobs/1602a5f936d531392f64e40c26e152dacc0b477f"
75+
},
76+
{
77+
"mode": "100644",
78+
"path": "legacy.py",
79+
"sha": "05d4d9333c56d43b8f26de053b17c1d0c8844a76",
80+
"size": 7584,
81+
"type": "blob",
82+
"url": "https://api.github.com/repos/sigmavirus24/github3.py/git/blobs/05d4d9333c56d43b8f26de053b17c1d0c8844a76"
83+
},
84+
{
85+
"mode": "100644",
86+
"path": "models.py",
87+
"sha": "2734a5f4f974ad9f4db5c27ae1e9a8ffc371922d",
88+
"size": 11154,
89+
"type": "blob",
90+
"url": "https://api.github.com/repos/sigmavirus24/github3.py/git/blobs/2734a5f4f974ad9f4db5c27ae1e9a8ffc371922d"
91+
},
92+
{
93+
"mode": "100644",
94+
"path": "notifications.py",
95+
"sha": "d30142d0432beeea999637c7d7b29562f7466c0b",
96+
"size": 4686,
97+
"type": "blob",
98+
"url": "https://api.github.com/repos/sigmavirus24/github3.py/git/blobs/d30142d0432beeea999637c7d7b29562f7466c0b"
99+
},
100+
{
101+
"mode": "100644",
102+
"path": "orgs.py",
103+
"sha": "0b4417e9616ddd1abf2078994db06586a2b81888",
104+
"size": 14477,
105+
"type": "blob",
106+
"url": "https://api.github.com/repos/sigmavirus24/github3.py/git/blobs/0b4417e9616ddd1abf2078994db06586a2b81888"
107+
},
108+
{
109+
"mode": "040000",
110+
"path": "packages",
111+
"sha": "6168db7e150f4c83346ce9e48c33aa571d745db4",
112+
"type": "tree",
113+
"url": "https://api.github.com/repos/sigmavirus24/github3.py/git/trees/6168db7e150f4c83346ce9e48c33aa571d745db4"
114+
},
115+
{
116+
"mode": "100644",
117+
"path": "pulls.py",
118+
"sha": "b3ab41d99c8ece6adeb65858a007b3c956c8401d",
119+
"size": 12267,
120+
"type": "blob",
121+
"url": "https://api.github.com/repos/sigmavirus24/github3.py/git/blobs/b3ab41d99c8ece6adeb65858a007b3c956c8401d"
122+
},
123+
{
124+
"mode": "100644",
125+
"path": "repos.py",
126+
"sha": "c5b7fc8919b2c4d569c09deb02f469af53670462",
127+
"size": 69890,
128+
"type": "blob",
129+
"url": "https://api.github.com/repos/sigmavirus24/github3.py/git/blobs/c5b7fc8919b2c4d569c09deb02f469af53670462"
130+
},
131+
{
132+
"mode": "100644",
133+
"path": "users.py",
134+
"sha": "84e86918c0665596c0036b50bf8e48de96fbbf8b",
135+
"size": 11335,
136+
"type": "blob",
137+
"url": "https://api.github.com/repos/sigmavirus24/github3.py/git/blobs/84e86918c0665596c0036b50bf8e48de96fbbf8b"
138+
}
139+
],
140+
"url": "https://api.github.com/repos/sigmavirus24/github3.py/git/trees/75b347329e3fc87ac78895ca1be58daff78872a1"
141+
}

0 commit comments

Comments
 (0)
0