8000 Fix Pull Request tests. · doismellburning/github3.py@6cdf714 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6cdf714

Browse files
committed
Fix Pull Request tests.
1 parent 8617803 commit 6cdf714

File tree

1 file changed

+28
-35
lines changed

1 file changed

+28
-35
lines changed

tests/test_pulls.py

Lines changed: 28 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -10,38 +10,32 @@
1010
class TestPullRequest(BaseTest):
1111
def __init__(self, methodName='runTest'):
1212
super(TestPullRequest, self).__init__(methodName)
13-
repo = self.g.repository(self.sigm, self.todo)
14-
self.pr = repo.pull_request(5)
13+
repo = self.g.repository(self.kr, 'requests')
14+
self.pr = repo.pull_request(833)
1515
self.body = [
16-
'I use this config setting to set the color for unprioritized items.',
17-
'', 'export DEFAULT=$LIGHT_GREY', '',
18-
('Should be on both of my branches. Feel free to pull from me '
19-
"whenever - I'm not always in the mood to add a pull request."
20-
' :-)')
16+
('Use dicts and lists where necessary but accept both dicts and lists'
17+
' of'), '2-tuples everywhere.'
2118
]
2219
self.body_html = [
2320
('<p>'
24-
'I use this config setting to set the color for unprioritized items.'
25-
'</p>'),
26-
'', '<p>export DEFAULT=$LIGHT_GREY</p>', '',
27-
('<p>Should be on both of my branches. Feel free to pull from me '
28-
"whenever - I'm not always in the mood to add a pull request."
29-
' :-)</p>')
21+
'Use dicts and lists where necessary but accept both dicts and lists'
22+
' of'
23+
'<br>'),
24+
'2-tuples everywhere.</p>'
3025
]
31-
self.url = 'https://github.com/{s.sigm}/{s.todo}/pull/5'.format(
32-
s=self)
26+
self.url = 'https://github.com/{0}/requests/pull/5'.format(self.kr)
3327

3428
def test_pull_request(self):
3529
expect(self.pr).isinstance(PullRequest)
3630

3731
def test_base(self):
3832
expect(self.pr.base).is_not_None()
3933
expect(self.pr.base).isinstance(PullDestination)
40-
expect(self.pr.base.label) == 'sigmavirus24:master'
34+
expect(self.pr.base.label) == 'kennethreitz:develop'
4135

4236
def test_body(self):
4337
expect(self.pr.body).isinstance(str_test)
44-
body = '\r\n'.join(self.body)
38+
body = '\n'.join(self.body)
4539
expect(self.pr.body) == body
4640

4741
def test_body_html(self):
@@ -69,7 +63,7 @@ def test_head(self):
6963
head = self.pr.head
7064
label = head.label
7165
expect(head).isinstance(PullDestination)
72-
expect(label) == 'jvstein:0171bf7bea88cac6884bb72bd26c07e6a826677e'
66+
expect(label) == 'sigmavirus24:fix_key_val_args'
7367

7468
def test_html_url(self):
7569
url = self.pr.html_url
@@ -130,12 +124,11 @@ def test_state(self):
130124
expect(self.pr.state) == 'closed'
131125

132126
def test_title(self):
133-
expect(self.pr.title) == ('Handle the DEFAULT config setting like'
134-
' todo.sh')
127+
expect(self.pr.title) == 'Fixes #817'
135128

136129
def test_user(self):
137130
expect(self.pr.user).isinstance(User)
138-
expect(self.pr.user.login) == 'jvstein'
131+
expect(self.pr.user.login) == self.sigm
139132

140133
def test_with_auth(self):
141134
if not self.auth:
@@ -212,8 +205,8 @@ def test_requires_auth(self):
212205
class TestPullDestination(BaseTest):
213206
def __init__(self, methodName='runTest'):
214207
super(TestPullDestination, self).__init__(methodName)
215-
repo = self.g.repository(self.sigm, self.todo)
216-
self.dest = repo.pull_request(5).base
208+
repo = self.g.repository(self.kr, 'requests')
209+
self.dest = repo.pull_request(833).base
217210

218211
def test_pull_destination(self):
219212
expect(self.dest).isinstance(PullDestination)
@@ -222,26 +215,26 @@ def test_direction(self):
222215
expect(self.dest.direction) == 'Base'
223216

224217
def test_label(self):
225-
expect(self.dest.label) == 'sigmavirus24:master'
218+
expect(self.dest.label) == 'kennethreitz:develop'
226219

227220
def test_sha(self):
228-
expect(self.dest.sha) == 'f55a45094f67d5659462c3fbb18d4bca97d92e7c'
221+
expect(self.dest.sha) == 'c8f166f696327dc8ec07a248863fcc35fafa2038'
229222

230223
def test_ref(self):
231-
expect(self.dest.ref) == 'master'
224+
expect(self.dest.ref) == 'develop'
232225

233226
def test_repo(self):
234-
expect(self.dest.repo) == (self.sigm, self.todo)
227+
expect(self.dest.repo) == (self.kr, 'requests')
235228

236229
def test_user(self):
237-
expect(self.dest.user.login) == self.sigm
230+
expect(self.dest.user.login) == self.kr
238231

239232

240233
class TestPullFile(BaseTest):
241234
def __init__(self, methodName='runTest'):
242235
super(TestPullFile, self).__init__(methodName)
243-
repo = self.g.repository(self.sigm, self.todo)
244-
self.pf = repo.pull_request(5).list_files()[0]
236+
repo = self.g.repository(self.kr, 'requests')
237+
self.pf = repo.pull_request(833).list_files()[0]
245238

246239
def test_file(self):
247240
expect(self.pf).isinstance(PullFile)
@@ -252,16 +245,16 @@ def test_additions(self):
252245
def test_blob_url(self):
253246
expect(self.pf.blob_url).isinstance(str_test)
254247
expect('blob' in self.pf.blob_url).is_True()
255-
expect('todo.py' in self.pf.blob_url).is_True()
248+
expect('compat.py' in self.pf.blob_url).is_True()
256249

257250
def test_changes(self):
258-
expect(self.pf.changes) == 4
251+
expect(self.pf.changes) == 2
259252

260253
def test_deletions(self):
261-
expect(self.pf.deletions) == 2
254+
expect(self.pf.deletions) == 0
262255

263256
def test_filename(self):
264-
expect(self.pf.filename) == 'todo.py'
257+
expect(self.pf.filename) == 'requests/compat.py'
265258

266259
def test_patch(self):
267260
expect(self.pf.patch).isinstance(str_test)
@@ -270,7 +263,7 @@ def test_raw_url(self):
270263
expect(self.pf.raw_url) == self.pf.blob_url.replace('blob', 'raw')
271264

272265
def test_sha(self):
273-
expect(self.pf.sha) == 'd9024b5b8a078011f8d1de7ec8c15218c9c9449b'
266+
expect(self.pf.sha) == '351b7c6e03070523b963d9adc71ef2b89a0fa574'
274267

275268
def test_status(self):
276269
expect(self.pf.status) == 'modified'

0 commit comments

Comments
 (0)
0