@@ -108,7 +108,7 @@ def test_close_project(self):
108108
109109 @responses .activate
110110 def test_update_project (self ):
111- # Tests creating a project. This also tests validating the project data as part of `api.create_project` .
111+ # Tests updating a project.
112112 with open ('./tests/test_files/update_project.json' , 'r' ) as update_project_file :
113113 update_project_data = json .load (update_project_file )
114114
@@ -133,3 +133,30 @@ def test_update_project(self):
133133 with self .assertRaises (DemandAPIError ):
134134 self .api .update_project (24 , update_project_data )
135135 self .assertEqual (len (responses .calls ), 2 )
136+
137+ @responses .activate
138+ def test_reconcile_project (self ):
139+ # Tests reconciling a project.
140+ message = 'testing reconciliation'
141+ with open ('./tests/test_files/Data+Quality+Request+Template.xlsx' , 'rb' ) as file :
142+ # Success response
143+ responses .add (
144+ responses .POST ,
145+ '{}/sample/v1/projects/24/reconcile' .format (BASE_HOST ),
146+ json = {'status' : {'message' : 'success' }},
147+ status = 200 )
148+ # Error message included
149+ responses .add (
150+ responses .POST ,
151+ '{}/sample/v1/projects/24/reconcile' .format (BASE_HOST ),
152+ json = {'status' : {'message' : 'error' }},
153+ status = 400 )
154+
155+ # Test successful response.
156+ self .api .reconcile_project (24 , file , message )
157+ self .assertEqual (len (responses .calls ), 1 )
158+
159+ # Test response with error included.
160+ with self .assertRaises (DemandAPIError ):
161+ self .api .reconcile_project (24 , file , message )
162+ self .assertEqual (len (responses .calls ), 2 )
0 commit comments