Esempio n. 1
0
 def test_drop_empty(self):
     header = SMTPAPIHeader()
     header.set_tos([])
     header.set_substitutions(json.loads('{"subKey":["subValue"]}'))
     header.set_sections(json.loads('{}'))
     header.set_categories([])
     header.set_unique_args(json.loads('{"testUnique":"uniqueValue"}'))
     header.add_filter('testFilter', 'filter', 'filterValue')
     self.assertEqual(self.dropsHeader, json.loads(header.json_string()))
Esempio n. 2
0
 def test_set(self):
     header = SMTPAPIHeader()
     header.set_tos(["*****@*****.**"])
     header.set_substitutions(json.loads('{"subKey":["subValue"]}'))
     header.set_sections(json.loads('{"testSection":"sectionValue"}'))
     header.set_categories(["testCategory"])
     header.set_unique_args(json.loads('{"testUnique":"uniqueValue"}'))
     header.add_filter('testFilter', 'filter', 'filterValue')
     self.assertEqual(self.validHeader, json.loads(header.json_string()))
Esempio n. 3
0
 def test_set(self):
     header = SMTPAPIHeader()
     header.set_tos(["*****@*****.**", "*****@*****.**", "*****@*****.**"])
     header.set_substitutions(json.loads('{"subKey":["subValue"]}'))
     header.set_sections(json.loads('{"testSection":"sectionValue"}'))
     header.set_categories(["testCategory"])
     header.set_unique_args(json.loads('{"testUnique":"uniqueValue"}'))
     header.set_asm_group_id(42)
     header.set_send_each_at([1409348513, 1409348514])
     header.set_send_at(1409348515)
     header.add_filter('testFilter', 'filter', 'filterValue')
     self.assertEqual(self.validHeader, json.loads(header.json_string()))
Esempio n. 4
0
 def test_set(self):
     header = SMTPAPIHeader()
     header.set_tos(
         ["*****@*****.**", "*****@*****.**", "*****@*****.**"])
     header.set_substitutions(json.loads('{"subKey":["subValue"]}'))
     header.set_sections(json.loads('{"testSection":"sectionValue"}'))
     header.set_categories(["testCategory"])
     header.set_unique_args(json.loads('{"testUnique":"uniqueValue"}'))
     header.set_asm_group_id(42)
     header.set_send_each_at([1409348513, 1409348514])
     header.set_send_at(1409348515)
     header.add_filter('testFilter', 'filter', 'filterValue')
     self.assertEqual(self.validHeader, json.loads(header.json_string()))
Esempio n. 5
0
 def test_drop_empty(self):
     header = SMTPAPIHeader()
     header.set_tos([])
     header.set_substitutions({
         "subKey": ["subValue"],
         "decimalKey": [decimal.Decimal("1.23456789")]
     })
     header.set_sections(json.loads('{}'))
     header.set_categories([])
     header.set_unique_args(json.loads('{"testUnique":"uniqueValue"}'))
     header.set_asm_group_id(None)
     header.set_send_each_at([])
     header.set_ip_pool(None)
     header.add_filter('testFilter', 'filter', 'filterValue')
     self.assertEqual(self.dropsHeader, json.loads(header.json_string()))
Esempio n. 6
0
 def test_drop_empty(self):
     header = SMTPAPIHeader()
     header.set_tos([])
     header.set_substitutions({
         "subKey": ["subValue"],
         "decimalKey": [decimal.Decimal("1.23456789")]
     })
     header.set_sections(json.loads('{}'))
     header.set_categories([])
     header.set_unique_args(json.loads('{"testUnique":"uniqueValue"}'))
     header.set_asm_group_id(None)
     header.set_send_each_at([])
     header.set_ip_pool(None)
     header.add_filter('testFilter', 'filter', 'filterValue')
     self.assertEqual(self.dropsHeader, json.loads(header.json_string()))
Esempio n. 7
0
# Python 2/3 compatible codebase
from __future__ import absolute_import, division, print_function

import time

if __name__ == '__main__' and __package__ is None:
    from os import sys, path
    sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
    from smtpapi import SMTPAPIHeader

from smtpapi import SMTPAPIHeader
header = SMTPAPIHeader()

# [To](http://sendgrid.com/docs/API_Reference/SMTP_API/index.html)
#header.add_to('*****@*****.**')
header.set_tos(['*****@*****.**', '*****@*****.**'])

# [Substitutions](http://sendgrid.com/docs/API_Reference/SMTP_API/substitution_tags.html)
#header.add_substitution('key', 'value')
header.set_substitutions({'key': ['value1', 'value2']})

# [Unique Arguments](http://sendgrid.com/docs/API_Reference/SMTP_API/unique_arguments.html)
#header.add_unique_arg('key', 'value')
header.set_unique_args({'key':'value'})

# [Categories](http://sendgrid.com/docs/API_Reference/SMTP_API/categories.html)
#header.add_category('category')
header.set_categories(['category1', 'category2'])

# [Sections](http://sendgrid.com/docs/API_Reference/SMTP_API/section_tags.html)
#header.add_section('key', 'section')
Esempio n. 8
0
from __future__ import absolute_import, division, print_function
from smtpapi import SMTPAPIHeader

import time

if __name__ == '__main__' and __package__ is None:
    from os import sys, path

    sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
    from smtpapi import SMTPAPIHeader

header = SMTPAPIHeader()

# [To](http://sendgrid.com/docs/API_Reference/SMTP_API/index.html)
# header.add_to('*****@*****.**')
header.set_tos(['*****@*****.**', '*****@*****.**'])

# [Substitutions](http://sendgrid.com/docs/API_Reference/SMTP_API/substitution_tags.html)
# header.add_substitution('key', 'value')
header.set_substitutions({'key': ['value1', 'value2']})

# [Unique Arguments](http://sendgrid.com/docs/API_Reference/SMTP_API/unique_arguments.html)
# header.add_unique_arg('key', 'value')
header.set_unique_args({'key': 'value'})

# [Categories](http://sendgrid.com/docs/API_Reference/SMTP_API/categories.html)
# header.add_category('category')
header.set_categories(['category1', 'category2'])

# [Sections](http://sendgrid.com/docs/API_Reference/SMTP_API/section_tags.html)
# header.add_section('key', 'section')