Skip to content

Commit e1b7047

Browse files
committed
Rewrite issue 50 test without using Http mock.
1 parent 0010b09 commit e1b7047

2 files changed

Lines changed: 6 additions & 19 deletions

File tree

tests/test_regression.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,14 @@
99

1010
from github2.client import Github
1111

12-
import utils
13-
1412

1513
def test_issue_50():
1614
"""Erroneous init of ``Http`` with proxy setup.
1715
1816
See https://github.com/ask/python-github2/pull/50
1917
"""
20-
utils.set_http_mock()
21-
2218
client = Github(proxy_host="my.proxy.com", proxy_port=9000)
23-
setup_args = client.request._http.called_with
24-
eq_(type(setup_args['proxy_info']), httplib2.ProxyInfo)
25-
eq_(setup_args['proxy_info'].proxy_host, 'my.proxy.com')
26-
eq_(setup_args['proxy_info'].proxy_port, 9000)
27-
28-
utils.unset_http_mock()
19+
proxy_info = client.request._http.proxy_info
20+
eq_(type(proxy_info), httplib2.ProxyInfo)
21+
eq_(proxy_info.proxy_host, 'my.proxy.com')
22+
eq_(proxy_info.proxy_port, 9000)

tests/utils.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,8 @@ class HttpMock(object):
3131
3232
"""
3333

34-
def __init__(self, cache=None, timeout=None, proxy_info=None,
35-
ca_certs=None):
36-
"""Create a mock httplib.Http object
37-
38-
.. attribute: called_with
39-
40-
``locals()`` during ``__init__``, for testing call spec
41-
"""
42-
self.called_with = locals()
34+
def __init__(self, *args, **kwargs):
35+
pass
4336

4437
def request(self, uri, method='GET', body=None, headers=None,
4538
redirections=5, connection_type=None):

0 commit comments

Comments
 (0)