Exemplo n.º 1
0
    def test_sendmail(self):
        aps = NotificationSchedule()
        aps.notification_settings = {
            "server": "mail.headstrong.de",
            "port": 587,
            "username": "******",
            "password": "******",
            "source_name" : "Unit Test Name",
            "source_email" : "*****@*****.**",
            "security": u'TLS',
            "encrypted_tip_template": { "en" : u"E tip template "},
            "encrypted_tip_mail_title": { "en" : u"E tip subj "},
            "plaintext_tip_template": { "en" : u"P tip template"},
            "plaintext_tip_mail_title": { "en" : u"P tip subj"},
            "file_template": { "en" : u"file file"},
            "file_mail_title": { "en" : u'title file'} ,
            "comment_template": { "en" : u"comment comment"},
            "comment_mail_title": { "en" : u'title comment'},
            "message_template" : { "en": u"message template" },
            "message_mail_title" : { "en" : u"msg mail title" },
        }

        # 100 as limit
        (tip_events, enqueued) = yield aps.create_tip_notification_events(0)
        self.assertEqual(enqueued, 2)

        yield aps.do_tip_notification(tip_events)
Exemplo n.º 2
0
    def test_notification_schedule_success(self):
        count = yield self.get_scheduled_email_count()
        self.assertEqual(count, 0)

        yield DeliverySchedule().run()

        notification_schedule = NotificationSchedule()
        notification_schedule.skip_sleep = True
        yield notification_schedule.run()

        count = yield self.get_scheduled_email_count()
        self.assertEqual(count, 0)
Exemplo n.º 3
0
    def test_notification_schedule_success(self):
        count = yield get_scheduled_email_count()
        self.assertEqual(count, 0)

        yield DeliverySchedule().run()

        notification_schedule = NotificationSchedule()
        notification_schedule.skip_sleep = True
        yield notification_schedule.run()

        count = yield get_scheduled_email_count()
        self.assertEqual(count, 0)
Exemplo n.º 4
0
    def test_notification_schedule(self):
        yield DeliverySchedule().operation()
        yield NotificationSchedule().operation()

        mail_schedule = MailflushSchedule()
        mail_schedule.skip_sleep = True
        yield mail_schedule.operation()
Exemplo n.º 5
0
    def test_sendmail(self):
        aps = NotificationSchedule()
        aps.notification_settings = {
            "server": "mail.headstrong.de",
            "port": 587,
            "username": "******",
            "password": "******",
            "source_name": "Unit Test Name",
            "source_email": "*****@*****.**",
            "security": u'TLS',
            "encrypted_tip_template": {
                "en": u"E tip template "
            },
            "encrypted_tip_mail_title": {
                "en": u"E tip subj "
            },
            "plaintext_tip_template": {
                "en": u"P tip template"
            },
            "plaintext_tip_mail_title": {
                "en": u"P tip subj"
            },
            "file_template": {
                "en": u"file file"
            },
            "file_mail_title": {
                "en": u'title file'
            },
            "comment_template": {
                "en": u"comment comment"
            },
            "comment_mail_title": {
                "en": u'title comment'
            },
            "message_template": {
                "en": u"message template"
            },
            "message_mail_title": {
                "en": u"msg mail title"
            },
        }

        # 100 as limit
        (tip_events, enqueued) = yield aps.create_tip_notification_events(0)
        self.assertEqual(enqueued, 2)

        yield aps.do_tip_notification(tip_events)
Exemplo n.º 6
0
    def test_notification_schedule_failure(self):
        count = yield get_scheduled_email_count()
        self.assertEqual(count, 0)

        yield DeliverySchedule().run()

        notification_schedule = NotificationSchedule()
        notification_schedule.skip_sleep = True

        def sendmail_failure(x):
            # simulate the failure just returning with no action
            return succeed(None)

        notification_schedule.sendmail = sendmail_failure

        for i in range(0, 10):
            yield notification_schedule.run()

            count = yield get_scheduled_email_count()
            self.assertEqual(count, 28)

        yield notification_schedule.run()

        count = yield get_scheduled_email_count()
        self.assertEqual(count, 0)
Exemplo n.º 7
0
    def test_notification_schedule_failure(self):
        count = yield self.get_scheduled_email_count()
        self.assertEqual(count, 0)

        yield DeliverySchedule().run()

        notification_schedule = NotificationSchedule()
        notification_schedule.skip_sleep = True

        def sendmail(x, y, z):
            return fail(True)

        notification_schedule.sendmail = sendmail

        for i in range(0, 10):
            yield notification_schedule.run()

            count = yield self.get_scheduled_email_count()
            self.assertEqual(count, 40)

        yield notification_schedule.run()

        count = yield self.get_scheduled_email_count()
        self.assertEqual(count, 0)
Exemplo n.º 8
0
    def test_notification_schedule_failure(self):
        count = yield get_scheduled_email_count()
        self.assertEqual(count, 0)

        yield DeliverySchedule().run()

        notification_schedule = NotificationSchedule()
        notification_schedule.skip_sleep = True

        def sendmail(x, y, z):
            return fail(True)

        notification_schedule.sendmail = sendmail

        for i in range(0, 10):
            yield notification_schedule.run()

            count = yield get_scheduled_email_count()
            self.assertEqual(count, 28)

        yield notification_schedule.run()

        count = yield get_scheduled_email_count()
        self.assertEqual(count, 0)
    def test_notification_schedule(self):
        yield DeliverySchedule().operation()

        notification_schedule = NotificationSchedule()
        notification_schedule.skip_sleep = True
        yield notification_schedule.operation()