Пример #1
0
    def setUp(self):
        """
        Initial Setup for the unit test
        """
        self.user = get_user_model()()
        self.user.username = "******"
        self.user.email = "*****@*****.**"
        self.user.set_password("blaah")
        self.user.save()

        self.notice_type_1 = NoticeType(
            label = "meeh",
            display = "meeh",
            description = "Meeh Meeh",
            default = 0,
        )
        self.notice_type_1.save()

        self.notice_type_2 = NoticeType(
            label = "daaa",
            display = "daaa",
            description = "Daaaa Daaaa",
            default = 1,
        )
        self.notice_type_2.save()
Пример #2
0
class NoticeSettingTest(TestCase):

    def setUp(self):
        """
        Initial Setup for the unit test
        """
        self.user = get_user_model()()
        self.user.username = "******"
        self.user.email = "*****@*****.**"
        self.user.set_password("blaah")
        self.user.save()

        self.notice_type_1 = NoticeType(
            label = "meeh",
            display = "meeh",
            description = "Meeh Meeh",
            default = 0,
        )
        self.notice_type_1.save()

        self.notice_type_2 = NoticeType(
            label = "daaa",
            display = "daaa",
            description = "Daaaa Daaaa",
            default = 1,
        )
        self.notice_type_2.save()


    def test_setting_default_notice_settings_for_a_user(self):
        """
        Test class method for saving default settings for a user.
        """

        NoticeSetting.set_user_default_notice_settings(self.user,0)
        obj_from_db_for_user = NoticeSetting.objects.filter(user = self.user)
        self.assertEqual(len(obj_from_db_for_user),2)

    def test_setting_default_notice_settings_correct_notices(self):
        """
        Test class method for saving default settings for a user. Make sure right
        notices have been saved.
        """

        NoticeSetting.set_user_default_notice_settings(self.user,0)
        obj_from_db_for_user = NoticeSetting.objects.filter(user = self.user).order_by('id')

        for notice_setting in obj_from_db_for_user:

            self.assertEqual(notice_setting.user,self.user)
            self.assertEqual(notice_setting.send,True)
Пример #3
0
    def notify_on_create(self):
        recipients = getattr(settings, 'SEIPETALI_ADMINS', [])
        recipients = [i[1] for i in recipients]

        try:
            notice_type = NoticeType.objects.get(label="new_alloggio")
        except NoticeType.DoesNotExist:
            notice_type = NoticeType().create(
                label="new_alloggio",
                display='Notifica creazione alloggio',
                description='Notifica creazione alloggio')

        #recipients = recipients[:1]
        # print recipients, notice_type, notice_type.id
        # if True:
        #     return

        for mail in recipients:
            try:
                notification_email.EmailBackend(10).deliver_to_recipient_email(
                    mail, None, notice_type, {"alloggio": self})
            except:
                pass
Пример #4
0
 def create_notice_types(app, created_models, verbosity, **kwargs):
     NoticeType.create(
         "system_message", _("System Message"),
         _("Important information about %s") % settings.STORYBASE_SITE_NAME)
Пример #5
0
def message_created(sender, instance, created, **kwargs):
    '''Notify the recipient that a new private message has been received.'''
    if created:
        target = reverse('ppmsg.views.view_detail', args=(instance.sender.username,))
        notice_type = NoticeType.create(label="private message", display=u"新私信", description=u"新私信")
        Notice.push(user=instance.recipient, notice_type=notice_type, target=target, content=instance.sender.username + u"给您发来新的私信")
 def create_notice_types(app, created_models, verbosity, **kwargs):
     NoticeType.create("received_email", "Private messages", "(this is highly recommended)")
def create_notice_types(app, created_models, verbosity, **kwargs):
    print "create message notifications"
    NoticeType.create("user_message", _("Message you"), _("Someone send you a message"), default = 2)
Пример #8
0
 def create_notice_types(app, created_models, verbosity, **kwargs):
     NoticeType.create("system_message", _("System Message"),
         _("Important information about %s") % settings.STORYBASE_SITE_NAME)
 def test_create(self):
     
     self.assertEquals(NoticeType.objects.count(), 0)
     NoticeType.create("notice_type", "New notice type", "You have a new notice type")
     self.assertEquals(NoticeType.objects.count(), 1)
Пример #10
0
def create_notice_types(app, created_models, verbosity, **kwargs):
    NoticeType.create("feedback_new", _("New feedback"), _("A new feedback was submitted"))
    NoticeType.create("feedback_updated", _("Feedback updated"), _("A feedback was updated"))
Пример #11
0
 def create_notice_types(app, created_models, verbosity, **kwargs):
     NoticeType.create("friends_invite", _("Invitation Received"), _("you have received an invitation"), default=2)
     NoticeType.create("friends_invite_sent", _("Invitation Sent"), _("you have sent an invitation"), default=1)
     NoticeType.create("friends_accept", _("Acceptance Received"), _("an invitation you sent has been accepted"), default=2)
     NoticeType.create("friends_accept_sent", _("Acceptance Sent"), _("you have accepted an invitation you received"), default=1)
     NoticeType.create("friends_otherconnect", _("Other Connection"), _("one of your friends has a new connection"), default=2)
     NoticeType.create("join_accept", _("Join Invitation Accepted"), _("an invitation you sent to join this site has been accepted"), default=2)
Пример #12
0
 def create_notice_types(app, created_models, verbosity, **kwargs):
     notification.create("messages_received", _("Message Received"), _("you have received a message"), default=2)
     notification.create("messages_sent", _("Message Sent"), _("you have sent a message"), default=1)
     notification.create("messages_replied", _("Message Replied"), _("you have replied to a message"), default=1)
     notification.create("messages_reply_received", _("Reply Received"), _("you have received a reply to a message"), default=2)
     notification.create("messages_deleted", _("Message Deleted"), _("you have deleted a message"), default=1)
     notification.create("messages_recovered", _("Message Recovered"), _("you have undeleted a message"), default=1)
def create_notice_types(app, created_models, verbosity, **kwargs):
    NoticeType.create(
        label = "tasks_new",
        display = _("New Task"),
        description = _("a new task been created"),
        default = 2
    )
    NoticeType.create(
        label = "tasks_comment",
        display = _("Task Comment"),
        description = _("a new comment has been made on a task"),
        default = 2
    )
    NoticeType.create(
        label = "tasks_change",
        display = _("Task State Change"),
        description = _("there has been a change in the state of a task"),
        default = 2
    )
    NoticeType.create(
        label = "tasks_assignment",
        display = _("Task Assignment"),
        description = _("a task has been (re)assigned"),
        default = 2
    )
    NoticeType.create(
        label = "tasks_status",
        display = _("Task Status Update"),
        description = _("there has been a status update to a task"),
        default = 2
    )
    NoticeType.create(
        label = "tasks_tags",
        display = _("Task Tag Update"),
        description = _("there has been a change in the tagging of a task"),
        default = 2
    )
    NoticeType.create(
        label = "tasks_nudge",
        display = _("Task Nudge"),
        description = _("there has been a nudge of a task"),
        default = 2
    )
Пример #14
0
 def create_notice_types(app, created_models, verbosity, **kwargs):
     NoticeType.create('event_delete', _('Event Deleted'), _('One of your events got deleted'))