1515
1616import ubersmith_client
1717from mock import Mock , patch
18-
1918from hamcrest import assert_that , raises , calling , equal_to
2019from requests .exceptions import ConnectionError , Timeout
21-
2220from ubersmith_client .exceptions import UbersmithException , BadRequest , UnknownError , Forbidden , NotFound , Unauthorized , \
2321 UbersmithConnectionError , \
2422 UbersmithTimeout
@@ -33,7 +31,7 @@ def setUp(self):
3331 self .password = 'test'
3432
3533 def test_process_ubersmith_response (self ):
36- response = Mock (status_code = 200 , headers = {" content-type" : " application/json" })
34+ response = Mock (status_code = 200 , headers = {' content-type' : ' application/json' })
3735
3836 json_data = {
3937 'client_id' : '1' ,
@@ -47,11 +45,11 @@ def test_process_ubersmith_response(self):
4745 self .assertDictEqual (json_data , UbersmithRequest .process_ubersmith_response (response ))
4846
4947 def test_process_ubersmith_response_not_application_json (self ):
50- response = Mock (status_code = 200 , headers = {" content-type" : " text/html" }, content = "42" )
48+ response = Mock (status_code = 200 , headers = {' content-type' : ' text/html' }, content = '42' )
5149 assert_that (response .content , equal_to (UbersmithRequest .process_ubersmith_response (response )))
5250
5351 def test_process_ubersmith_response_raise_exception (self ):
54- response = Mock (status_code = 400 , headers = {" content-type" : " application/json" })
52+ response = Mock (status_code = 400 , headers = {' content-type' : ' application/json' })
5553 assert_that (calling (UbersmithRequest .process_ubersmith_response ).with_args (response ), raises (BadRequest ))
5654
5755 response .status_code = 401
@@ -69,7 +67,7 @@ def test_process_ubersmith_response_raise_exception(self):
6967 response .status_code = 200
7068 response .json = Mock (return_value = {'status' : False , 'error_code' : 42 , 'error_message' : 'come and watch tv' })
7169 assert_that (calling (UbersmithRequest .process_ubersmith_response ).with_args (response ),
72- raises (UbersmithException , " Error code 42 - message: come and watch tv" ))
70+ raises (UbersmithException , ' Error code 42 - message: come and watch tv' ))
7371
7472 @patch ('ubersmith_client.ubersmith_request_post.requests' )
7573 def test_api_method_returns_handle_connection_error_exception (self , requests_mock ):
0 commit comments