Exemplo n.º 1
0
def test_send_conferences_confirmation_email(mock_send_email, inspire_app):
    expected_recipient = "*****@*****.**"
    conference = {"control_number": "1234"}
    expected_subject = "Your conference(1234) has been successfully submitted!"
    expected_content = render_template(
        "mailing/conferences/submission_confirmation/base.html",
        conference=conference,
        host=current_app.config["SERVER_NAME"],
    )
    send_conference_confirmation_email(expected_recipient, conference)
    mock_send_email.assert_called_once_with(
        sender=current_app.config["CONFERENCES_CONFIRMATION_EMAIL_ADDRESS"],
        recipient=expected_recipient,
        subject=expected_subject,
        body=expected_content,
    )
Exemplo n.º 2
0
    def post(self):
        """Adds new conference record"""

        data = self.load_data_from_request()

        record = ConferencesRecord.create(data)
        db.session.commit()
        if not is_superuser_or_cataloger_logged_in():
            self.create_ticket(record, "rt/new_conference.html")
            send_conference_confirmation_email(current_user.email, record)
        return (
            jsonify(
                {"pid_value": record["control_number"], "cnum": record.get("cnum")}
            ),
            201,
        )