@@ -169,7 +169,7 @@ def test_get_survey_status_error_handled(self):
169169 with self .assertRaises (CmixError ):
170170 self .cmix_api .get_survey_status (self .survey_id )
171171
172- def test_get_survey_sources (self ):
172+ def test_get_survey_locales (self ):
173173 self .cmix_api ._authentication_headers = {'Authentication' : 'Bearer test' }
174174
175175 # success case
@@ -178,7 +178,31 @@ def test_get_survey_sources(self):
178178 mock_get .status_code = 200
179179 mock_get .json .return_value = {}
180180 mock_request .get .return_value = mock_get
181+ self .cmix_api .get_survey_locales (self .survey_id )
182+
183+ base_url = CMIX_SERVICES ['survey' ]['BASE_URL' ]
184+ surveys_url = '{}/surveys/{}/locales' .format (base_url , self .survey_id )
185+ mock_request .get .assert_any_call (surveys_url , headers = self .cmix_api ._authentication_headers )
186+
187+ # error case (survey not found)
188+ with mock .patch ('CmixAPIClient.api.requests' ) as mock_request :
189+ mock_get = mock .Mock ()
190+ mock_get .status_code = 404
191+ mock_get .json .return_value = {}
192+ mock_request .get .return_value = mock_get
181193
194+ with self .assertRaises (CmixError ):
195+ self .cmix_api .get_survey_locales (self .survey_id )
196+
197+ def test_get_survey_sources (self ):
198+ self .cmix_api ._authentication_headers = {'Authentication' : 'Bearer test' }
199+
200+ # success case
201+ with mock .patch ('CmixAPIClient.api.requests' ) as mock_request :
202+ mock_get = mock .Mock ()
203+ mock_get .status_code = 200
204+ mock_get .json .return_value = {}
205+ mock_request .get .return_value = mock_get
182206 self .cmix_api .get_survey_sources (self .survey_id )
183207
184208 base_url = CMIX_SERVICES ['survey' ]['BASE_URL' ]
0 commit comments