Skip to content

Commit

Permalink
Merge pull request #413 from gabrielkrell/asm-optionality
Browse files Browse the repository at this point in the history
Error-checking in Mail helper/ASM
  • Loading branch information
Matt Bernier committed Oct 30, 2017
2 parents f1933ff + 02576b3 commit 7c5bf33
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sendgrid/helpers/mail/asm.py
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
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

0 comments on commit 7c5bf33

Please sign in to comment.