Skip to content

Commit ae4b1fe

Browse files
Cutoff before merge into master
1 parent 2fd6290 commit ae4b1fe

File tree

4 files changed

+52
-31
lines changed

4 files changed

+52
-31
lines changed

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
**NEW:**
77

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

1112
**This library allows you to quickly and easily use the SendGrid Web API v3 via Python.**

sendgrid/helpers/endpoints/ip/unassigned.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ def unassigned(data, as_json=False):
4141
response = sg.client.ips.get(query_params=params)
4242
if response.status_code == 201:
4343
data = response.body
44-
unused = unassinged(data) """
44+
unused = unassigned(data)
45+
"""
4546

4647
no_subusers = set()
4748

test/test_mail.py renamed to test/test_mail_helpers.py

Lines changed: 44 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,40 +10,55 @@
1010
EmailMessage = message.Message
1111

1212
from sendgrid.helpers.mail import (
13-
Asm,
14-
ApiKeyIncludedException,
15-
Attachment,
16-
BccSettings,
17-
BypassListManagement,
18-
Category,
19-
ClickTracking,
20-
Content,
21-
CustomArg,
22-
DynamicTemplateData,
23-
Email,
24-
FooterSettings,
25-
From,
26-
Ganalytics,
27-
Header,
28-
Mail,
29-
MailSettings,
30-
OpenTracking,
31-
Personalization,
32-
SandBoxMode,
33-
Section,
34-
SendGridException,
35-
SpamCheck,
36-
Subject,
37-
SubscriptionTracking,
38-
Substitution,
39-
TrackingSettings,
40-
To,
41-
ValidateApiKey
13+
Asm, ApiKeyIncludedException, Attachment, BccSettings,
14+
BypassListManagement, Category, ClickTracking, Content, CustomArg,
15+
DynamicTemplateData, Email, FooterSettings, From, Ganalytics, Header,
16+
Mail, MailSettings, OpenTracking, Personalization, SandBoxMode, Section,
17+
SendGridException, SpamCheck, Subject, SubscriptionTracking, Substitution,
18+
TrackingSettings, To, ValidateApiKey
4219
)
4320

4421

4522
class UnitTests(unittest.TestCase):
4623

24+
def test_asm(self):
25+
from sendgrid.helpers.mail import (GroupId, GroupsToDisplay)
26+
asm1 = Asm(GroupId(1), GroupsToDisplay([1, 2, 3]))
27+
asm2 = Asm(1, [1, 2, 3])
28+
self.assertEqual(
29+
asm1.group_id.get(), asm2.group_id.get())
30+
self.assertEqual(
31+
asm1.groups_to_display.get(), asm2.groups_to_display.get())
32+
33+
def test_attachment(self):
34+
from sendgrid.helpers.mail import (FileContent, FileType, FileName,
35+
Disposition, ContentId)
36+
a1 = Attachment(
37+
FileContent('Base64EncodedString'),
38+
FileName('example.pdf'),
39+
FileType('application/pdf'),
40+
Disposition('attachment'),
41+
ContentId('123')
42+
)
43+
a2 = Attachment(
44+
'Base64EncodedString',
45+
'example.pdf',
46+
'application/pdf',
47+
'attachment',
48+
'123'
49+
)
50+
self.assertEqual(a1.file_content.get(), a2.file_content.get())
51+
self.assertEqual(a1.file_name.get(), a2.file_name.get())
52+
self.assertEqual(a1.file_type.get(), a2.file_type.get())
53+
self.assertEqual(a1.disposition.get(), a2.disposition.get())
54+
self.assertEqual(a1.content_id.get(), a2.content_id.get())
55+
56+
def test_batch_id(self):
57+
from sendgrid.helpers.mail import BatchId
58+
59+
b1 = BatchId('1')
60+
self.assertEqual('1', b1.get())
61+
4762
# Send a Single Email to a Single Recipient
4863
def test_single_email_to_a_single_recipient(self):
4964
from sendgrid.helpers.mail import (Mail, From, To, Subject,

test/test_sendgrid.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import sendgrid
2+
from sendgrid.helpers.endpoints.ip.unassigned import unassigned
23
from sendgrid.helpers.mail import *
34
import os
45
import datetime
@@ -859,7 +860,10 @@ def test_ips_get(self):
859860
headers = {'X-Mock': 200}
860861
response = self.sg.client.ips.get(
861862
query_params=params, request_headers=headers)
862-
self.assertEqual(response.status_code, 200)
863+
data = response.body
864+
unused = unassigned(data)
865+
self.assertEqual(type(unused), list)
866+
self.assertEqual(response.status_code, 200)
863867

864868
def test_ips_assigned_get(self):
865869
headers = {'X-Mock': 200}

0 commit comments

Comments
 (0)