Skip to content

Commit

Permalink
Remove 2 sec sleep and update domain
Browse files Browse the repository at this point in the history
  • Loading branch information
jm-mailosaur committed Feb 1, 2021
1 parent c74500c commit c33de22
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

env:
MAILOSAUR_BASE_URL: https://mailosaur.com/
MAILOSAUR_SMTP_HOST: mailosaur.io
MAILOSAUR_SMTP_HOST: mailosaur.net
MAILOSAUR_SMTP_PORT: 2525
MAILOSAUR_API_KEY: ${{ secrets.MAILOSAUR_API_KEY }}
MAILOSAUR_SERVER: ${{ secrets.MAILOSAUR_SERVER }}
Expand Down
4 changes: 2 additions & 2 deletions mailosaur/operations/servers_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ def __init__(self, session, base_url, handle_http_error):
self.handle_http_error = handle_http_error

def generate_email_address(self, server):
host = os.getenv('MAILOSAUR_SMTP_HOST', 'mailosaur.io')
host = os.getenv('MAILOSAUR_SMTP_HOST', 'mailosaur.net')
randomString = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10))
return "%s.%s@%s" % (randomString, server, host)
return "%s@%s.%s" % (randomString, server, host)

def list(self):
"""List all servers.
Expand Down
4 changes: 2 additions & 2 deletions tests/emails_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ def test_list_received_after(self):
self.assertEqual(0, len(future_emails))

def test_get(self):
host = os.getenv('MAILOSAUR_SMTP_HOST', 'mailosaur.io')
test_email_address = "wait_for_test.%s@%s" % (self.server, host)
host = os.getenv('MAILOSAUR_SMTP_HOST', 'mailosaur.net')
test_email_address = "wait_for_test@%s.%s" % (self.server, host)

Mailer.send_email(self.client, self.server, test_email_address)

Expand Down
4 changes: 2 additions & 2 deletions tests/files_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def setUpClass(cls):

cls.client.messages.delete_all(cls.server)

host = os.getenv('MAILOSAUR_SMTP_HOST', 'mailosaur.io')
test_email_address = "files_test.%s@%s" % (cls.server, host)
host = os.getenv('MAILOSAUR_SMTP_HOST', 'mailosaur.net')
test_email_address = "files_test@%s.%s" % (cls.server, host)

Mailer.send_email(cls.client, cls.server, test_email_address)

Expand Down
5 changes: 1 addition & 4 deletions tests/mailer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@ def send_emails(client, server, quantity):
for i in range(0, quantity):
Mailer.send_email(client, server)

# Allow 2 seconds for any SMTP processing
time.sleep(2)

@staticmethod
def send_email(client, server, send_to_address = None):
host = os.getenv('MAILOSAUR_SMTP_HOST', 'mailosaur.io')
host = os.getenv('MAILOSAUR_SMTP_HOST', 'mailosaur.net')
port = os.getenv('MAILOSAUR_SMTP_PORT', '25')

message = MIMEMultipart('related')
Expand Down

0 comments on commit c33de22

Please sign in to comment.