Fixed rest of the test cases frappe/frapp#478

This commit is contained in:
Anand Doshi
2014-04-09 19:20:01 +05:30
parent d29465029d
commit 9fd50bcfb6
23 changed files with 705 additions and 656 deletions

View File

@@ -7,36 +7,36 @@ class TestNewsletter(unittest.TestCase):
def test_get_recipients_lead(self):
w = frappe.get_doc(test_records[0])
w.insert()
self.assertTrue("test_lead@example.com" in w.controller.get_recipients())
self.assertTrue("test_lead@example.com" in w.get_recipients())
frappe.db.sql("""delete from `tabBulk Email`""")
w.controller.send_emails()
w.send_emails()
self.assertTrue(frappe.db.get_value("Bulk Email", {"recipient": "test_lead@example.com"}))
def test_get_recipients_lead_by_status(self):
w = frappe.get_doc(test_records[0])
w.lead_status="Converted"
w.insert()
self.assertTrue("test_lead3@example.com" in w.controller.get_recipients())
self.assertTrue("test_lead3@example.com" in w.get_recipients())
def test_get_recipients_contact_customer(self):
w = frappe.get_doc(test_records[1])
w.insert()
self.assertTrue("test_contact_customer@example.com" in w.controller.get_recipients())
self.assertTrue("test_contact_customer@example.com" in w.get_recipients())
def test_get_recipients_contact_supplier(self):
w = frappe.get_doc(test_records[1])
w.contact_type="Supplier"
w.insert()
self.assertTrue("test_contact_supplier@example.com" in w.controller.get_recipients())
self.assertTrue("test_contact_supplier@example.com" in w.get_recipients())
def test_get_recipients_custom(self):
w = frappe.get_doc(test_records[2])
w.insert()
self.assertTrue("test_custom2@example.com" in w.controller.get_recipients())
self.assertTrue(frappe.db.get("Lead",
self.assertTrue("test_custom2@example.com" in w.get_recipients())
self.assertTrue(frappe.db.get("Lead",
{"email_id": "test_custom2@example.com"}))
test_dependencies = ["Lead", "Contact"]
test_records = frappe.get_test_records('Newsletter')
test_records = frappe.get_test_records('Newsletter')