Esempio n. 1
0
	def test_unsubscribe(self):
		from webnotes.utils.email_lib.bulk import unsubscribe, send
		webnotes.form_dict = {
			'email':'*****@*****.**',
			'type':'Lead',
			'email_field':'email_id'
		}
		unsubscribe()

		send(recipients = ['*****@*****.**', '*****@*****.**'], 
			doctype='Lead', email_field='email_id', first_name_field='lead_name',
			last_name_field=None, subject='Testing Bulk', message='This is a bulk mail!')
		
		bulk = webnotes.conn.sql("""select * from `tabBulk Email` where status='Not Sent'""", 
			as_dict=1)
		self.assertEquals(len(bulk), 1)
		self.assertFalse('*****@*****.**' in [d['recipient'] for d in bulk])
		self.assertTrue('*****@*****.**' in [d['recipient'] for d in bulk])
		self.assertTrue('Unsubscribe' in bulk[0]['message'])
Esempio n. 2
0
    def test_unsubscribe(self):
        from webnotes.utils.email_lib.bulk import unsubscribe, send

        webnotes.form_dict = {"email": "*****@*****.**", "type": "Lead", "email_field": "email_id"}
        unsubscribe()

        send(
            recipients=["*****@*****.**", "*****@*****.**"],
            doctype="Lead",
            email_field="email_id",
            subject="Testing Bulk",
            message="This is a bulk mail!",
        )

        bulk = webnotes.conn.sql("""select * from `tabBulk Email` where status='Not Sent'""", as_dict=1)
        self.assertEquals(len(bulk), 1)
        self.assertFalse("*****@*****.**" in [d["recipient"] for d in bulk])
        self.assertTrue("*****@*****.**" in [d["recipient"] for d in bulk])
        self.assertTrue("Unsubscribe" in bulk[0]["message"])
Esempio n. 3
0
	def test_unsubscribe(self):
		from webnotes.utils.email_lib.bulk import unsubscribe, send
		webnotes.form_dict = {
			'email':'*****@*****.**',
			'type':'Profile',
			'email_field':'email',
			"from_test": True
		}
		unsubscribe()

		send(recipients = ['*****@*****.**', '*****@*****.**'], 
			doctype='Profile', email_field='email', 
			subject='Testing Bulk', message='This is a bulk mail!')
		
		bulk = webnotes.conn.sql("""select * from `tabBulk Email` where status='Not Sent'""", 
			as_dict=1)
		self.assertEquals(len(bulk), 1)
		self.assertFalse('*****@*****.**' in [d['recipient'] for d in bulk])
		self.assertTrue('*****@*****.**' in [d['recipient'] for d in bulk])
		self.assertTrue('Unsubscribe' in bulk[0]['message'])
Esempio n. 4
0
	def test_unsubscribe(self):
		from webnotes.utils.email_lib.bulk import unsubscribe, send
		webnotes.local.form_dict = {
			'email':'*****@*****.**',
			'type':'Profile',
			'email_field':'email',
			"from_test": True
		}
		unsubscribe()

		send(recipients = ['*****@*****.**', '*****@*****.**'], 
			sender="*****@*****.**",
			doctype='Profile', email_field='email', 
			subject='Testing Bulk', message='This is a bulk mail!')
		
		bulk = webnotes.conn.sql("""select * from `tabBulk Email` where status='Not Sent'""", 
			as_dict=1)
		self.assertEquals(len(bulk), 1)
		self.assertFalse('*****@*****.**' in [d['recipient'] for d in bulk])
		self.assertTrue('*****@*****.**' in [d['recipient'] for d in bulk])
		self.assertTrue('Unsubscribe' in bulk[0]['message'])