def test_should_return_ca_unavailable_for_request(self): retry_msec = 123 status_msg = 'Test status' self.result.status = ( cert_man.CertificateStatus.CA_UNAVAILABLE_FOR_REQUEST) self.result.retry_msec = retry_msec self.result.status_message = status_msg order_ref = hrefs.convert_order_to_href(self.order.id) cert_res.check_certificate_request(self.order, self.project, self.result_follow_on) self._verify_check_certificate_plugins_called() epm = self.cert_event_plugin_patcher.target._EVENT_PLUGIN_MANAGER epm.notify_ca_is_unavailable.assert_called_once_with( self.project.id, order_ref, status_msg, retry_msec ) self.assertEqual( common.RetryTasks.INVOKE_SAME_TASK, self.result_follow_on.retry_task) self.assertEqual( cert_res.ORDER_STATUS_CA_UNAVAIL_FOR_CHECK.id, self.result_follow_on.status) self.assertEqual( cert_res.ORDER_STATUS_CA_UNAVAIL_FOR_CHECK.message, self.result_follow_on.status_message)
def handle_order(self, order): """Handle checking the status of a certificate order. :param order: Order to process. :return: None if no follow on processing is needed for this task, otherwise a :class:`FollowOnProcessingStatusDTO` instance with information on how to process this task into the future. """ result_follow_on = common.FollowOnProcessingStatusDTO() order_info = order.to_dict_fields() order_type = order_info.get('type') # Retrieve the project. project = self.project_repo.get(order.project_id) if order_type != models.OrderType.CERTIFICATE: raise NotImplementedError( u._('Order type "{order_type}" not supported.').format( order_type=order_type)) # Request a certificate new_container = cert.check_certificate_request( order, project, result_follow_on) if new_container: order.container_id = new_container.id LOG.debug("...done checking status of a certificate order.") return result_follow_on
def handle_order(self, order): """Handle checking the status of a certificate order. :param order: Order to process. :return: None if no follow on processing is needed for this task, otherwise a :class:`FollowOnProcessingStatusDTO` instance with information on how to process this task into the future. """ result_follow_on = common.FollowOnProcessingStatusDTO() order_info = order.to_dict_fields() order_type = order_info.get('type') # Retrieve the project. project = self.project_repo.get(order.project_id) if order_type != models.OrderType.CERTIFICATE: raise NotImplementedError( u._('Order type "{order_type}" not supported.').format( order_type=order_type)) # Request a certificate new_container = cert.check_certificate_request(order, project, result_follow_on) if new_container: order.container_id = new_container.id LOG.debug(u._("...done checking status of a certificate order.")) return result_follow_on