forked from douban/code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_pull.py
More file actions
36 lines (30 loc) · 1.16 KB
/
test_pull.py
File metadata and controls
36 lines (30 loc) · 1.16 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
# encoding: utf-8
from base import APITestCase
TITLE = "pull_title"
BODY = "pull_body"
class PullTest(APITestCase):
def test_commits(self):
"""
Test http://code.dapps.douban.com/api/%s/pulls/%s/commits
"""
# TODO: implements this function
pass
def ttest_create_pull(self): # FIXME
project = self.get_temp_project()
fork_project = self.get_temp_project(project)
api_token = self.create_api_token(project.owner_id)
ret = self.app.post_json(
"/api/repos/%s/pulls/" % project.name,
dict(title=TITLE,
body=BODY,
base_ref="master",
head="chinese",
head_repo=fork_project.name),
headers=dict(Authorization="Bearer %s" % api_token.token)
).json
self.assertEqual(ret['base']['ref'], 'master')
self.assertEqual(ret['base']['repo']['name'], project.name)
self.assertEqual(ret['head']['ref'], 'chinese')
self.assertEqual(ret['head']['repo']['name'], fork_project.name)
self.assertEqual(ret['title'], TITLE)
self.assertEqual(ret['description'], BODY)