def handle(self, *args, **options): if __name__ == '__main__': route_email() else: fp = StringIO() fp.write(stdin.read()) route_email(fp)
def test_email_subscription(self): "Tests that an unknown email sent to <list>-subscribe@<domain> will be created and subscribed correctly." address = "*****@*****.**" mailing_list = self.mailing_list email = self.create_test_email(address, ["%s-subscribe@%s" % (mailing_list.address, mailing_list.site.domain)]) route_email(email) import pdb pdb.set_trace() self.assertEquals(len(mail.outbox), 1) self.assertTrue(mailing_list.is_subscribed(address)) email = self.create_test_email(address, ["%s-unsubscribe@%s" % (mailing_list.address, mailing_list.site.domain)]) route_email(email) self.assertEquals(len(mail.outbox), 1) self.assertFalse(mailing_list.is_subscribed(address))