Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: task has no realistic integration test #11

Open
jacquerie opened this issue Feb 25, 2016 · 0 comments
Open

tests: task has no realistic integration test #11

jacquerie opened this issue Feb 25, 2016 · 0 comments

Comments

@jacquerie
Copy link
Contributor

We are currently only unit testing the task, but we are not testing it a realistic environment, such as a real RabbitMQ instance using the MessagePack protocol. This could be hiding bugs, especially when sending emails with attachments:

def test_send_message_with_attachments(email_task_app):
"""Test sending a message with attachments."""
with email_task_app.app_context():
filename = pkg_resources.resource_filename(
__name__, os.path.join('attachments', 'invenio.svg'))
content_type = 'image/svg+xml'
data = pkg_resources.resource_string(
__name__, os.path.join('attachments', 'invenio.svg'))
attachments = [Attachment(filename, content_type, data)]
msg = {
'subject': 'Test3',
'sender': '[email protected]',
'recipients': ['[email protected]'],
'attachments': attachments
}
send_email.delay(msg)
result_stream = email_task_app.extensions['invenio-mail'].stream
assert result_stream.getvalue().find(
'Content-Transfer-Encoding: base64') != -1
assert result_stream.getvalue().find(
'Content-Disposition: attachment;') != -1
def test_send_message_with_date(email_task_app):
"""Test sending a message with a date."""
with email_task_app.app_context():
msg = {
'subject': 'Test4',
'sender': '[email protected]',
'recipients': ['[email protected]'],
'date': 1456242014.398119
}
send_email.delay(msg)
result_stream = email_task_app.extensions['invenio-mail'].stream
assert result_stream.getvalue().find('Date: Tue, 23 Feb 2016') != -1
.

See #9 (comment) for more details.

@jirikuncar jirikuncar added this to the v1.0.0 milestone Jul 4, 2016
@lnielsen lnielsen changed the title The task has no realistic integration test tests: task has no realistic integration test Dec 9, 2016
@lnielsen lnielsen modified the milestones: someday, v1.0.0 Dec 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants