-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
701ff66
commit 2a904b7
Showing
13 changed files
with
96 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,9 +31,9 @@ Send single email: | |
|
||
.. code-block:: python | ||
>>> from postmarker.core import ServerClient | ||
>>> server_client = ServerClient(token='API_TOKEN') | ||
>>> server_client.emails.send( | ||
>>> from postmarker.core import PostmarkClient | ||
>>> postmark = PostmarkClient(token='API_TOKEN') | ||
>>> postmark.emails.send( | ||
From='[email protected]', | ||
To='[email protected]', | ||
Subject='Postmark test', | ||
|
@@ -44,7 +44,7 @@ Send batch: | |
|
||
.. code-block:: python | ||
>>> server_client.emails.send_batch( | ||
>>> postmark.emails.send_batch( | ||
{ | ||
From='[email protected]', | ||
To='[email protected]', | ||
|
@@ -63,7 +63,7 @@ Setup an email: | |
|
||
.. code-block:: python | ||
>>> email = server_client.emails.Email( | ||
>>> email = postmark.emails.Email( | ||
From='[email protected]', | ||
To='[email protected]', | ||
Subject='Postmark test', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ Sending emails is super easy! Here is the most simple case: | |
|
||
.. code-block:: python | ||
>>> server_client.emails.send( | ||
>>> postmark.emails.send( | ||
From='[email protected]', | ||
To='[email protected]', | ||
Subject='Postmark test', | ||
|
@@ -31,13 +31,13 @@ Or send ``MIMEText``/``MIMEMultipart`` instances: | |
>>> message = MIMEText('Text') | ||
>>> message['From'] = '[email protected]' | ||
>>> message['To'] = '[email protected]' | ||
>>> server_client.emails.send(message=message) | ||
>>> postmark.emails.send(message=message) | ||
To specify multiple recipients (or ``Cc`` / ``Bcc``) you could pass values as list or string with comma separated values: | ||
|
||
.. code-block:: python | ||
>>> server_client.emails.send( | ||
>>> postmark.emails.send( | ||
From='[email protected]', | ||
To=['[email protected]', '[email protected]'], # The same as '[email protected], [email protected]' | ||
Subject='Postmark test', | ||
|
@@ -48,7 +48,7 @@ Headers could be specified as dict: | |
|
||
.. code-block:: python | ||
>>> server_client.emails.send( | ||
>>> postmark.emails.send( | ||
From='[email protected]', | ||
To='[email protected]', | ||
Headers={'X-Accept-Language': 'en-us, en'}, | ||
|
@@ -76,7 +76,7 @@ Then pass them to :py:meth:`~postmarker.models.emails.EmailManager.send`: | |
|
||
.. code-block:: python | ||
>>> server_client.emails.send( | ||
>>> postmark.emails.send( | ||
From='[email protected]', | ||
To='[email protected]', | ||
Subject='Postmark test', | ||
|
@@ -88,7 +88,7 @@ To send email in batch there is :py:meth:`~postmarker.models.emails.EmailManager | |
|
||
.. code-block:: python | ||
>>> server_client.emails.send_batch( | ||
>>> postmark.emails.send_batch( | ||
{ | ||
From='[email protected]', | ||
To='[email protected]', | ||
|
@@ -114,7 +114,7 @@ To get more flexibility it is possible to use :py:class:`Email` objects. | |
|
||
.. code-block:: python | ||
>>> email = server_client.emails.Email( | ||
>>> email = postmark.emails.Email( | ||
From='[email protected]', | ||
To='[email protected]', | ||
Subject='Postmark test', | ||
|
@@ -162,7 +162,7 @@ Batches are available via :py:meth:`~postmarker.models.emails.EmailManager.Email | |
|
||
.. code-block:: python | ||
>>> batch = server_client.emails.EmailBatch(email) | ||
>>> batch = postmark.emails.EmailBatch(email) | ||
>>> len(batch) | ||
1 | ||
>>> batch.send() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# coding=utf-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
|
||
from betamax import Betamax | ||
from betamax_serializers import pretty_json | ||
from postmarker.core import AccountClient, ServerClient | ||
from postmarker.core import PostmarkClient | ||
|
||
from ._compat import patch | ||
from .helpers import replace_real_credentials | ||
|
@@ -28,7 +28,7 @@ def pytest_unconfigure(config): | |
|
||
|
||
@pytest.yield_fixture(autouse=True, scope='module') | ||
def betamax_recorder(request, server_client): | ||
def betamax_recorder(request, postmark): | ||
""" | ||
Module level Betamax recorder. | ||
""" | ||
|
@@ -38,7 +38,7 @@ def betamax_recorder(request, server_client): | |
record_mode = 'none' if os.environ.get('TRAVIS') else 'once' | ||
cassette_name = getattr(request.node._obj, 'CASSETTE_NAME', 'default') | ||
vcr = Betamax( | ||
server_client.session, | ||
postmark.session, | ||
cassette_library_dir=CASSETTE_DIR, | ||
default_cassette_options={ | ||
'preserve_exact_body_bytes': True, | ||
|
@@ -66,30 +66,25 @@ def api_token(): | |
|
||
|
||
@pytest.fixture(scope='session') | ||
def server_client(api_token): | ||
return ServerClient(token=api_token) | ||
def postmark(api_token): | ||
return PostmarkClient(token=api_token) | ||
|
||
|
||
@pytest.fixture(scope='session') | ||
def account_client(api_token): | ||
return AccountClient(token=api_token) | ||
def bounce(postmark): | ||
return postmark.bounces.get(723626745) | ||
|
||
|
||
@pytest.fixture(scope='session') | ||
def bounce(server_client): | ||
return server_client.bounces.get(723626745) | ||
|
||
|
||
@pytest.fixture(scope='session') | ||
def server(server_client): | ||
return server_client.server.get() | ||
def server(postmark): | ||
return postmark.server.get() | ||
|
||
|
||
@pytest.fixture() | ||
def email(server_client): | ||
return server_client.emails.Email(From='[email protected]', To='[email protected]', TextBody='text') | ||
def email(postmark): | ||
return postmark.emails.Email(From='[email protected]', To='[email protected]', TextBody='text') | ||
|
||
|
||
@pytest.fixture | ||
def email_batch(server_client, email): | ||
return server_client.emails.EmailBatch(email) | ||
def email_batch(postmark, email): | ||
return postmark.emails.EmailBatch(email) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.