def test_update_faq_method_handle_not_found(self, mock_request_params_dict): with self.app.app_context(): faq = FaqFactory() update_faq_info = FaqFactory.build() mock_request_params_dict.return_value = { 'question': update_faq_info.question } faq_controller = FaqController(self.request_context) response = faq_controller.update_faq(1000) self.assertEqual(response.status_code, 404) self.assertEqual(response.get_json()['msg'], 'FAQ Not Found')
def test_update_faq_method_succeeds(self, mock_request_params_dict): with self.app.app_context(): faq = FaqFactory() update_faq_info = FaqFactory.build() mock_request_params_dict.return_value = { 'question': update_faq_info.question } faq_controller = FaqController(self.request_context) response = faq_controller.update_faq(faq.id) self.assertEqual(response.status_code, 201) self.assertEqual(response.get_json()['msg'], 'OK') self.assertEqual(response.get_json()['payload']['faq']['question'], update_faq_info.question)