Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita7fce11

Browse files
committed
Made some progress.
1 parent7d3e494 commita7fce11

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

‎tests/json/emails

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
['user@example.com']
1+
["user@example.com"]

‎tests/test_github.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ def test_authorization(self):
1313
args= ('get','https://api.github.com/authorizations/10')
1414
withexpect.githuberror():
1515
self.g.authorization(10)
16+
assertself.request.calledisFalse
1617

1718
self.login()
1819
a=self.g.authorization(10)
@@ -60,8 +61,9 @@ def test_create_issue(self):
6061
deftest_create_key(self):
6162
self.request.return_value=generate_response('key',201)
6263

63-
k=self.g.create_key(None,None)
64-
assertkisNone
64+
withexpect.githuberror():
65+
k=self.g.create_key(None,None)
66+
assertkisNone
6567
assertself.request.calledisFalse
6668

6769
self.login()
@@ -70,7 +72,7 @@ def test_create_key(self):
7072
assertself.request.calledisTrue
7173

7274
deftest_create_repo(self):
73-
self.request.return_value=generate_response('repository',201)
75+
self.request.return_value=generate_response('repo',201)
7476
self.login()
7577
r=self.g.create_repo('Repository')
7678
expect(r).isinstance(github3.repos.Repository)
@@ -138,7 +140,7 @@ def test_issue(self):
138140
self.request.return_value=generate_response('issue',200)
139141
args= ('get','https://api.github.com/repos/user/repo/issues/1')
140142

141-
assertself.g.issue(None,None)isNone
143+
assertself.g.issue(None,None,0)isNone
142144
withpatch.object(github3.github.GitHub,'repository')asrepo:
143145
repo.return_value=github3.repos.Repository(load(path('repo')))
144146
i=self.g.issue(1)

‎tests/utils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def generate_response(path_name, status_code=200, enc='utf-8', _iter=False):
1111
r.status_code=status_code
1212
r.encoding=enc
1313
ifpath_name:
14-
content=path(path_name).read()
14+
content=path(path_name).read().strip()
1515
if_iter:
1616
content='[{0}]'.format(content)
1717
r.raw=BytesIO(content.encode())
@@ -63,15 +63,15 @@ def githuberror(cls):
6363
classBaseCase(TestCase):
6464
defsetUp(self):
6565
self.g=github3.GitHub()
66-
self.request=patch_request()
67-
self.request.start()
66+
self.conf= {'allow_redirects':True}
67+
self.mock=patch.object(requests.sessions.Session,'request')
68+
self.request=self.mock.start()
6869

6970
deftearDown(self):
70-
self.request.stop()
71+
self.mock.stop()
7172

7273
deflogin(self):
7374
self.g.login('user','password')
74-
self.conf= {'allow_redirects':True}
7575

7676
defmock_assertions(self,*args,**kwargs):
7777
assertself.request.calledisTrue

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp