9
9
10
10
BASE_HOST = "http://test-url.example"
11
11
12
+
12
13
class TestTemplateEndpoints (unittest .TestCase ):
13
14
def setUp (self ):
14
15
self .api = DemandAPIClient (client_id = 'test' , username = 'testuser' , password = 'testpass' , base_host = BASE_HOST )
@@ -19,7 +20,10 @@ def test_get_templates(self):
19
20
# Tests getting all templates.
20
21
with open ('./tests/test_files/get_templates.json' , 'r' ) as options :
21
22
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' ),
23
27
json = options_json ,
24
28
status = 200 )
25
29
self .api .get_templates ('US' , 'en' )
@@ -74,15 +78,13 @@ def test_delete_template(self):
74
78
responses .DELETE ,
75
79
'{}/sample/v1/templates/quotaplan/1' .format (BASE_HOST ),
76
80
json = {'status' : {'message' : 'success' }},
77
- status = 200
78
- )
81
+ status = 200 )
79
82
# Response with error status
80
83
responses .add (
81
84
responses .DELETE ,
82
85
'{}/sample/v1/templates/quotaplan/1' .format (BASE_HOST ),
83
86
json = {'status' : {'message' : 'error' }},
84
- status = 200
85
- )
87
+ status = 200 )
86
88
# Test successful response
87
89
self .api .delete_template (1 )
88
- self .assertEqual (len (responses .calls ), 1 )
90
+ self .assertEqual (len (responses .calls ), 1 )
0 commit comments