-
-
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
d7b92a1
commit 5bf9865
Showing
30 changed files
with
43 additions
and
63 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
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 |
---|---|---|
@@ -1,7 +1,5 @@ | ||
# coding: utf-8 | ||
from setuptools import setup | ||
|
||
import postmarker | ||
from setuptools import find_packages, setup | ||
|
||
install_requires = ["requests>=2.20.0"] | ||
|
||
|
@@ -13,8 +11,7 @@ | |
setup( | ||
name="postmarker", | ||
url="https://github.com/Stranger6667/postmarker", | ||
version=postmarker.__version__, | ||
packages=["postmarker", "postmarker.models", "postmarker.django"], | ||
version="0.14.1", | ||
license="MIT", | ||
author="Dmitry Dygalo", | ||
author_email="[email protected]", | ||
|
@@ -23,6 +20,9 @@ | |
keywords=["postmark", "api", "client", "email"], | ||
description="Python client library for Postmark API", | ||
long_description=long_description, | ||
long_description_content_type="text/x-rst", | ||
packages=find_packages(where="src"), | ||
package_dir={"": "src"}, | ||
classifiers=[ | ||
"Development Status :: 4 - Beta", | ||
"Environment :: Console", | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import os | ||
import sys | ||
from email import encoders | ||
from email.mime.base import MIMEBase | ||
from email.mime.image import MIMEImage | ||
|
@@ -19,12 +18,12 @@ def get_attachment_path(filename): | |
|
||
ATTACHMENT = { | ||
"Name": "readme.txt", | ||
"Content": "dGVzdCBjb250ZW50", | ||
"Content": "dGVzdCBjb250ZW50Cg==", | ||
"ContentType": "text/plain", | ||
} | ||
TUPLE_ATTACHMENT = ATTACHMENT["Name"], ATTACHMENT["Content"], ATTACHMENT["ContentType"] | ||
MIME_ATTACHMENT = MIMEBase("text", "plain") | ||
MIME_ATTACHMENT.set_payload("dGVzdCBjb250ZW50") | ||
MIME_ATTACHMENT.set_payload("dGVzdCBjb250ZW50Cg==") | ||
MIME_ATTACHMENT.add_header("Content-Disposition", "attachment", filename="readme.txt") | ||
PATH_ATTACHMENT = get_attachment_path("readme.txt") | ||
|
||
|
@@ -63,12 +62,7 @@ def get_mime_message(text, html_text=None, **kwargs): | |
|
||
MIME_MESSAGE = get_mime_message("Text", **DEFAULT_HEADERS) | ||
MIME_ALTERNATIVE = get_mime_message("Text", "HTML content", **DEFAULT_HEADERS) | ||
|
||
if sys.version_info[0] < 3: | ||
ENCODED_CONTENT = "dGVzdCBjb250ZW50" | ||
else: | ||
ENCODED_CONTENT = "dGVzdCBjb250ZW50\n" | ||
|
||
ENCODED_CONTENT = "dGVzdCBjb250ZW50\n" | ||
|
||
IMAGE = MIMEImage(b"test content", "png", name="image1.png") | ||
IMAGE.add_header("Content-ID", "<[email protected]>") | ||
|
@@ -280,13 +274,13 @@ def test_attach_unknown_content_type(self, email, postmark_request): | |
assert postmark_request.call_args[1]["json"]["Attachments"] == [ | ||
{ | ||
"Name": "report.blabla", | ||
"Content": "dGVzdCBjb250ZW50", | ||
"Content": "dGVzdCBjb250ZW50Cg==", | ||
"ContentType": "application/octet-stream", | ||
} | ||
] | ||
|
||
def test_attach_binary(self, email, postmark_request): | ||
email.attach_binary(b"test content", "readme.txt") | ||
email.attach_binary(b"test content\n", "readme.txt") | ||
email.send() | ||
assert postmark_request.call_args[1]["json"]["Attachments"] == [ATTACHMENT] | ||
|
||
|
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 |
---|---|---|
@@ -1,22 +1,6 @@ | ||
import sys | ||
|
||
import pytest | ||
|
||
from postmarker.core import PostmarkClient | ||
|
||
|
||
def test_postmark_client(postmark_client, postmark_request): | ||
assert isinstance(postmark_client, PostmarkClient) | ||
assert postmark_client.mock is postmark_request | ||
|
||
|
||
@pytest.mark.skipif(sys.version_info[0] == 3, reason="Mock is required only for Python 2") | ||
def test_mock_not_installed(): | ||
sys.modules["mock"] = None | ||
del sys.modules["postmarker._compat"] | ||
del sys.modules["postmarker.pytest"] | ||
|
||
from postmarker.pytest import postmark_request | ||
|
||
with pytest.raises(AssertionError, matches="To use pytest fixtures on Python 2.*"): | ||
list(postmark_request()) |
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