Skip to content

Commit

Permalink
improving the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Murray Christopherson committed Jul 13, 2020
1 parent fd468a8 commit f593bf7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ before_install:
install:
- pipenv install --dev
script:
- coverage run --source=quick_email -m unittest discover tests
- pipenv run coverage run --source=quick_email -m unittest discover tests
after_script:
- coveralls
- pipenv run coveralls
9 changes: 7 additions & 2 deletions tests/test_quick_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,20 @@


class TestQuickEmail(unittest.TestCase):
def run(self, *args, **kwargs):
result = super().run(*args, **kwargs)

time.sleep(smtp.SMTP_RATE_LIMIT_SECONDS)

return result

def test_send_email_auth(self):
send_email(smtp.SMTP_HOST, smtp.SMTP_PORT, u'Example <example@example.com>', u'The Subject', send_to=u'Test <test@test.com>',
plain_text=u'Some Text', html_text=u'<b>Some Bold Text</b>', username=smtp.SMTP_USERNAME, password=smtp.SMTP_PASSWORD)
time.sleep(smtp.SMTP_RATE_LIMIT_SECONDS)

def test_send_email_starttls_auth(self):
send_email(smtp.SMTP_HOST, smtp.SMTP_PORT, u'Example <example@example.com>', u'The Subject', send_to=u'Test <test@test.com>',
plain_text=u'Some Text', html_text=u'<b>Some Bold Text</b>', username=smtp.SMTP_USERNAME, password=smtp.SMTP_PASSWORD, require_starttls=True)
time.sleep(smtp.SMTP_RATE_LIMIT_SECONDS)


if __name__ == u'__main__':
Expand Down
9 changes: 7 additions & 2 deletions tests/test_sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,24 @@


class TestSender(unittest.TestCase):
def run(self, *args, **kwargs):
result = super().run(*args, **kwargs)

time.sleep(smtp.SMTP_RATE_LIMIT_SECONDS)

return result

def test_minimal(self):
msg = builder.build_msg(u'Example <example@example.com>', u'The Subject',
send_to=u'Test <test@test.com>', plain_text=u'Some Text', html_text=u'<b>Some Bold Text</b>')
sender.send_msg(msg, smtp.SMTP_HOST, smtp.SMTP_PORT, username=smtp.SMTP_USERNAME,
password=smtp.SMTP_PASSWORD, require_starttls=True)
time.sleep(smtp.SMTP_RATE_LIMIT_SECONDS)

def test_multiple_recipients(self):
msg = builder.build_msg(u'Example <example@example.com>', u'The Subject', send_to=u'Test <test@test.com>', send_cc=[
u'Example <example@example.com>', u'Example2 <example2@example.com>'], send_bcc=u'Example3 <example3@example.com>', plain_text=u'Some Text', html_text=u'<b>Some Bold Text</b>')
sender.send_msg(msg, smtp.SMTP_HOST, smtp.SMTP_PORT, username=smtp.SMTP_USERNAME,
password=smtp.SMTP_PASSWORD, require_starttls=True)
time.sleep(smtp.SMTP_RATE_LIMIT_SECONDS)


if __name__ == u'__main__':
Expand Down

0 comments on commit f593bf7

Please sign in to comment.