Skip to content

Commit

Permalink
Cutoff before merge into master
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkingserious committed Apr 2, 2019
1 parent 2fd6290 commit ae4b1fe
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 31 deletions.
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
**NEW:**

- Subscribe to email `notifications`_ for releases and breaking changes.
- Version 6.X release is a BREAKING CHANGE, please see the release notes for details.
- Quickly get started with `Docker`_.

**This library allows you to quickly and easily use the SendGrid Web API v3 via Python.**
Expand Down
3 changes: 2 additions & 1 deletion sendgrid/helpers/endpoints/ip/unassigned.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def unassigned(data, as_json=False):
response = sg.client.ips.get(query_params=params)
if response.status_code == 201:
data = response.body
unused = unassinged(data) """
unused = unassigned(data)
"""

no_subusers = set()

Expand Down
73 changes: 44 additions & 29 deletions test/test_mail.py → test/test_mail_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,55 @@
EmailMessage = message.Message

from sendgrid.helpers.mail import (
Asm,
ApiKeyIncludedException,
Attachment,
BccSettings,
BypassListManagement,
Category,
ClickTracking,
Content,
CustomArg,
DynamicTemplateData,
Email,
FooterSettings,
From,
Ganalytics,
Header,
Mail,
MailSettings,
OpenTracking,
Personalization,
SandBoxMode,
Section,
SendGridException,
SpamCheck,
Subject,
SubscriptionTracking,
Substitution,
TrackingSettings,
To,
ValidateApiKey
Asm, ApiKeyIncludedException, Attachment, BccSettings,
BypassListManagement, Category, ClickTracking, Content, CustomArg,
DynamicTemplateData, Email, FooterSettings, From, Ganalytics, Header,
Mail, MailSettings, OpenTracking, Personalization, SandBoxMode, Section,
SendGridException, SpamCheck, Subject, SubscriptionTracking, Substitution,
TrackingSettings, To, ValidateApiKey
)


class UnitTests(unittest.TestCase):

def test_asm(self):
from sendgrid.helpers.mail import (GroupId, GroupsToDisplay)
asm1 = Asm(GroupId(1), GroupsToDisplay([1, 2, 3]))
asm2 = Asm(1, [1, 2, 3])
self.assertEqual(
asm1.group_id.get(), asm2.group_id.get())
self.assertEqual(
asm1.groups_to_display.get(), asm2.groups_to_display.get())

def test_attachment(self):
from sendgrid.helpers.mail import (FileContent, FileType, FileName,
Disposition, ContentId)
a1 = Attachment(
FileContent('Base64EncodedString'),
FileName('example.pdf'),
FileType('application/pdf'),
Disposition('attachment'),
ContentId('123')
)
a2 = Attachment(
'Base64EncodedString',
'example.pdf',
'application/pdf',
'attachment',
'123'
)
self.assertEqual(a1.file_content.get(), a2.file_content.get())
self.assertEqual(a1.file_name.get(), a2.file_name.get())
self.assertEqual(a1.file_type.get(), a2.file_type.get())
self.assertEqual(a1.disposition.get(), a2.disposition.get())
self.assertEqual(a1.content_id.get(), a2.content_id.get())

def test_batch_id(self):
from sendgrid.helpers.mail import BatchId

b1 = BatchId('1')
self.assertEqual('1', b1.get())

# Send a Single Email to a Single Recipient
def test_single_email_to_a_single_recipient(self):
from sendgrid.helpers.mail import (Mail, From, To, Subject,
Expand Down
6 changes: 5 additions & 1 deletion test/test_sendgrid.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sendgrid
from sendgrid.helpers.endpoints.ip.unassigned import unassigned
from sendgrid.helpers.mail import *
import os
import datetime
Expand Down Expand Up @@ -859,7 +860,10 @@ def test_ips_get(self):
headers = {'X-Mock': 200}
response = self.sg.client.ips.get(
query_params=params, request_headers=headers)
self.assertEqual(response.status_code, 200)
data = response.body
unused = unassigned(data)
self.assertEqual(type(unused), list)
self.assertEqual(response.status_code, 200)

def test_ips_assigned_get(self):
headers = {'X-Mock': 200}
Expand Down

0 comments on commit ae4b1fe

Please sign in to comment.