99
1010BASE_HOST = "http://test-url.example"
1111
12+
1213class TestTemplateEndpoints (unittest .TestCase ):
1314 def setUp (self ):
1415 self .api = DemandAPIClient (client_id = 'test' , username = 'testuser' , password = 'testpass' , base_host = BASE_HOST )
@@ -19,7 +20,10 @@ def test_get_templates(self):
1920 # Tests getting all templates.
2021 with open ('./tests/test_files/get_templates.json' , 'r' ) as options :
2122 options_json = json .load (options )
22- responses .add (responses .GET , '{}/sample/v1/templates/quotaplan/{}/{}' .format (BASE_HOST , 'US' , 'en' ),
23+ # Success response
24+ responses .add (
25+ responses .GET ,
26+ '{}/sample/v1/templates/quotaplan/{}/{}' .format (BASE_HOST ,'US' ,'en' ),
2327 json = options_json ,
2428 status = 200 )
2529 self .api .get_templates ('US' , 'en' )
@@ -74,15 +78,13 @@ def test_delete_template(self):
7478 responses .DELETE ,
7579 '{}/sample/v1/templates/quotaplan/1' .format (BASE_HOST ),
7680 json = {'status' : {'message' : 'success' }},
77- status = 200
78- )
81+ status = 200 )
7982 # Response with error status
8083 responses .add (
8184 responses .DELETE ,
8285 '{}/sample/v1/templates/quotaplan/1' .format (BASE_HOST ),
8386 json = {'status' : {'message' : 'error' }},
84- status = 200
85- )
87+ status = 200 )
8688 # Test successful response
8789 self .api .delete_template (1 )
88- self .assertEqual (len (responses .calls ), 1 )
90+ self .assertEqual (len (responses .calls ), 1 )
0 commit comments