Skip to content

Commit

Permalink
Add a sanity test for proxies
Browse files Browse the repository at this point in the history
  • Loading branch information
paulosman committed Mar 6, 2012
1 parent 8c4d939 commit 8a9d17b
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions soundcloud/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,28 @@ def test_method_dispatching_post_request(fake_post):
allow_redirects=True)
.returns(MockResponse("{}")))
client.post('tracks')


@patch('requests.get')
def test_proxy_servers(fake_request):
"""Test that providing a dictionary of proxy servers works."""
proxies = {
'http': 'myproxyserver:1234'
}
client = soundcloud.Client(client_id='foo', proxies=proxies)
expected_url = "%s?%s" % (
client._resolve_resource_name('me'),
urlencode({
'client_id': 'foo'
})
)
headers = {
'User-Agent': soundcloud.USER_AGENT
}
(fake_request.expects_call()
.with_args(expected_url,
headers=headers,
proxies=proxies,
allow_redirects=True)
.returns(MockResponse("{}")))
client.get('/me')

0 comments on commit 8a9d17b

Please sign in to comment.