55import unittest
66import responses
77
8- try :
9- from unittest .mock import patch
10- except ImportError :
11- from mock import patch
12-
138from dynatademand .api import DemandAPIClient
149from dynatademand .errors import DemandAPIError
1510
@@ -25,7 +20,11 @@ def setUp(self):
2520 def test_get_line_item (self ):
2621 with open ('./tests/test_files/get_line_item.json' , 'r' ) as line_item_file :
2722 line_item_json = json .load (line_item_file )
28- responses .add (responses .GET , '{}/sample/v1/projects/1/lineItems/100' .format (BASE_HOST ), json = line_item_json , status = 200 )
23+ responses .add (
24+ responses .GET ,
25+ '{}/sample/v1/projects/1/lineItems/100' .format (BASE_HOST ),
26+ json = line_item_json ,
27+ status = 200 )
2928 self .api .get_line_item (1 , 100 )
3029 self .assertEqual (len (responses .calls ), 1 )
3130 self .assertEqual (responses .calls [0 ].response .json (), line_item_json )
@@ -43,7 +42,11 @@ def test_get_line_items(self):
4342 def test_get_line_item_detailed_report (self ):
4443 with open ('./tests/test_files/get_line_item_detailed_report.json' , 'r' ) as line_item_detailed_report_file :
4544 line_item_detailed_report_json = json .load (line_item_detailed_report_file )
46- responses .add (responses .GET , '{}/sample/v1/projects/1/lineItems/100/detailedReport' .format (BASE_HOST ), json = line_item_detailed_report_json , status = 200 )
45+ responses .add (
46+ responses .GET ,
47+ '{}/sample/v1/projects/1/lineItems/100/detailedReport' .format (BASE_HOST ),
48+ json = line_item_detailed_report_json ,
49+ status = 200 )
4750 self .api .get_line_item_detailed_report (1 , 100 )
4851 self .assertEqual (len (responses .calls ), 1 )
4952 self .assertEqual (responses .calls [0 ].response .json (), line_item_detailed_report_json )
0 commit comments