Example #1
0
 def test_full_html(self):
     stack = helpers.create_stack()
     e = Email.find_by_id_anon(stack['email_id'])
     e.html = '<h1>this is the new test html, {{ First Name }}</h1>'
     e.preheader = "I am a preheader"
     check = "<span class='preheader'>%s</span>%s<br>%s" % (e.preheader, e.html, e.account.footer_html)
     self.assertEqual(e.full_html(), check)
Example #2
0
 def test_campaign_determiner_duplicates_true(self):
     stack = helpers.create_stack()
     c = Campaign.find_by_id_anon(stack['campaign_id'])
     e = Email.find_by_id_anon(stack['email_id'])
     e.update(selector_col_val='["dog"]')
     e2 = Email.create(account_id=c.account_id, name="EmailTwo", campaign_id=c.id)
     e2.update(selector_col_val='["dog"]')
     self.assertEqual(c.determiner_duplicates(),(True,'dog'))
Example #3
0
 def test_render_text_attr(self):
     stack = helpers.create_stack()
     e = Email.find_by_id_anon(stack['email_id'])
     data = {
         'First Name': 'Bobby Lee'
     }
     check = 'text only here Bobby Lee\n\nContact Us - http://localhost:5000/pf/vib/12345, http://localhost:5000/pf/unsubscribe/12345'
     self.assertEqual(e.render_text_attr(data,'12345'), check)
Example #4
0
 def test_render_html_attr(self):
     stack = helpers.create_stack()
     e = Email.find_by_id_anon(stack['email_id'])
     data = {
         'First Name': 'Bobby Lee'
     }
     check = '<b>Body here, Hi Bobby Lee</b><br>http://localhost:5000/pf/vib/12345, http://localhost:5000/pf/unsubscribe/12345'
     self.assertEqual(e.render_html_attr(data,'12345'), check)
Example #5
0
 def test_full_text(self):
     stack = helpers.create_stack()
     e = Email.find_by_id_anon(stack['email_id'])
     e.html = '<h1>this is the new test html, {{ First Name }}</h1>'
     e.text = 'text only test'
     e.preheader = "I am a preheader"
     check = "%s\n\n%s" % (e.text, e.account.footer_text)
     self.assertEqual(e.full_text(), check)
Example #6
0
 def test_campaign_email_determiner_none(self):
     stack = helpers.create_stack()
     c = Campaign.find_by_id_anon(stack['campaign_id'])
     c.update(selector_col_name='dog')
     e = Email.find_by_id_anon(stack['email_id'])
     e.update(selector_col_val='["woof"]')
     e2 = Email.create(account_id=c.account_id, name="EmailTwo", campaign_id=c.id)
     e2.update(selector_col_val='["heina"]')
     self.assertEqual(c.email_determiner({'dog': 'cat'}), None)
Example #7
0
 def test_check_keys(self):
     stack = helpers.create_stack()
     e = Email.find_by_id_anon(stack['email_id'])
     mylist = List.find_by_id_anon(stack['list_id'])
     e.html = "cats and {{dogs}}"
     e.save()
     mylist.import_data="{['cats': 'no_dogs']}"
     mylist.save()
     self.assertEqual( e.check_keys(stack['list_id']), (False, 'dogs') )
Example #8
0
 def test_campaign_get_selector_import_data(self):
     stack = helpers.create_stack()
     l = List.find_by_id_anon(stack['list_id'])
     l.import_data = [{"dog": "cat"}, {"dog": "bird"}]
     l.save()
     c = Campaign.find_by_id_anon(stack['campaign_id'])
     c.selector_col_name = 'dog'
     c.save()
     e = Email.find_by_id_anon(stack['email_id'])
     e.selector_col_val = '["cat"]'
     e.save()
     self.assertEqual(c.get_selector_import_data(), [{'dog': 'cat'}])
Example #9
0
 def test_dispatcher_send_email_from_data_no_email(self):
     stack = helpers.create_stack()
     d = Dispatcher.find_by_id_anon(stack['dispatcher_id'])
     c = Campaign.find_by_id_anon(stack['campaign_id'])
     e = Email.find_by_id_anon(stack['email_id'])
     c.update(selector_col_name='dog')
     e.update(selector_col_val='["false"]')
     send_cnt = Send.query.count()
     sk_cnt = int(d.get_skipped())
     d.send_email_from_data({'dog': 'cat'})
     self.assertEqual(send_cnt, Send.query.count())
     self.assertEqual(str(sk_cnt + 1), d.get_skipped())
Example #10
0
 def test_campaign_email_determiner_no_specification(self):
     stack = helpers.create_stack()
     c = Campaign.find_by_id_anon(stack['campaign_id'])
     e = Email.find_by_id_anon(stack['email_id'])
     e2 = Email.create(account_id=c.account_id, name="EmailTwo", campaign_id=c.id)
     self.assertEqual(c.email_determiner({}), e)
Example #11
0
 def test_campaign_check_email_keys_good(self):
     stack = helpers.create_stack()
     e = Email.find_by_id_anon(stack['email_id'])
     e.update(html="{{bad_test}}")
     c = Campaign.find_by_id_anon(stack['campaign_id'])
     self.assertEqual(c.check_email_keys(),(False,"bad_test"))
Example #12
0
 def test_campaign_check_email_keys_bad(self):
     stack = helpers.create_stack()
     e = Email.find_by_id_anon(stack['email_id'])
     e.update(html="{{test}}")
     c = Campaign.find_by_id_anon(stack['campaign_id'])
     self.assertEqual(c.check_email_keys(),(True,None))