Skip to content

Commit

Permalink
Fixing unit tests breaking on str decode.
Browse files Browse the repository at this point in the history
  • Loading branch information
jkeyes committed Aug 20, 2015
1 parent 0a265f6 commit 11630ec
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions tests/unit/test_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from intercom.client import Client
from intercom.request import Request
from intercom import UnexpectedError
from mock import Mock
from mock import patch
from nose.tools import assert_raises
from nose.tools import eq_
Expand All @@ -23,7 +22,7 @@ def setUp(self):

@istest
def it_raises_resource_not_found(self):
resp = mock_response('{}', status_code=404)
resp = mock_response(None, status_code=404)
with patch('requests.request') as mock_method:
mock_method.return_value = resp
with assert_raises(intercom.ResourceNotFound):
Expand All @@ -32,7 +31,7 @@ def it_raises_resource_not_found(self):

@istest
def it_raises_authentication_error_unauthorized(self):
resp = mock_response('{}', status_code=401)
resp = mock_response(None, status_code=401)
with patch('requests.request') as mock_method:
mock_method.return_value = resp
with assert_raises(intercom.AuthenticationError):
Expand All @@ -41,7 +40,7 @@ def it_raises_authentication_error_unauthorized(self):

@istest
def it_raises_authentication_error_forbidden(self):
resp = mock_response('{}', status_code=403)
resp = mock_response(None, status_code=403)
with patch('requests.request') as mock_method:
mock_method.return_value = resp
with assert_raises(intercom.AuthenticationError):
Expand All @@ -50,7 +49,7 @@ def it_raises_authentication_error_forbidden(self):

@istest
def it_raises_server_error(self):
resp = Mock(encoding="utf-8", content='{}', status_code=500)
resp = mock_response(None, status_code=500)
with patch('requests.request') as mock_method:
mock_method.return_value = resp
with assert_raises(intercom.ServerError):
Expand All @@ -59,7 +58,7 @@ def it_raises_server_error(self):

@istest
def it_raises_bad_gateway_error(self):
resp = mock_response('{}', status_code=502)
resp = mock_response(None, status_code=502)
with patch('requests.request') as mock_method:
mock_method.return_value = resp
with assert_raises(intercom.BadGatewayError):
Expand All @@ -68,7 +67,7 @@ def it_raises_bad_gateway_error(self):

@istest
def it_raises_service_unavailable_error(self):
resp = mock_response('{}', status_code=503)
resp = mock_response(None, status_code=503)
with patch('requests.request') as mock_method:
mock_method.return_value = resp
with assert_raises(intercom.ServiceUnavailableError):
Expand Down

0 comments on commit 11630ec

Please sign in to comment.