def test_send(self, environ, login, client): buffer = io.StringIO("message") mail.send_mail(buffer) login.assert_called_once_with("12345") message = { "text": "message", "subject": "FEC Update: dev | api", "from_email": "*****@*****.**", "to": [{"email": "*****@*****.**"}], } client.messages.send.assert_called_once_with(message=message, async=False)
def test_send(self, environ, login, client): buffer = io.StringIO('message') mail.send_mail(buffer) login.assert_called_once_with('12345') message = { 'text': 'message', 'subject': 'FEC Update: dev | api', 'from_email': '*****@*****.**', 'to': [{ 'email': '*****@*****.**' }], } client.messages.send.assert_called_once_with(message=message, async=False)
def refresh(): """Update incremental aggregates and materialized views, then email logs to the development team. """ buffer = io.StringIO() with mail.CaptureLogs(manage.logger, buffer): try: manage.update_aggregates() manage.refresh_materialized() download.clear_bucket() except Exception as error: manage.logger.exception(error) try: mail.send_mail(buffer) except Exception as error: logger.exception(error)
def refresh(): """Update incremental aggregates and materialized views, then email logs to the development team. """ buffer = io.StringIO() with mail.CaptureLogs(manage.logger, buffer): try: manage.update_aggregates() manage.refresh_materialized() download.clear_bucket() legal_docs.index_advisory_opinions() legal_docs.load_advisory_opinions_into_s3() # TODO: needs to work with celery # legal_docs.load_current_murs() except Exception as error: manage.logger.exception(error) try: mail.send_mail(buffer) except Exception as error: logger.exception(error)