Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error-checking in Mail helper/ASM #413

Merged
merged 8 commits into from
Oct 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sendgrid/helpers/mail/asm.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ def groups_to_display(self):

@groups_to_display.setter
def groups_to_display(self, value):
if value is not None and len(value) > 25:
raise ValueError("New groups_to_display exceeds max length of 25.")
self._groups_to_display = value

def get(self):
Expand Down
3 changes: 3 additions & 0 deletions test/test_mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,9 @@ def test_unicode_values_in_substitutions_helper(self):
json.dumps(expected_result, sort_keys=True)
)

def test_asm_display_group_limit(self):
self.assertRaises(ValueError, ASM, 1, list(range(26)))

def test_disable_tracking(self):
tracking_settings = TrackingSettings()
tracking_settings.click_tracking = ClickTracking(False, False)
Expand Down