예제 #1
0
    def test_handle_message(self):

        handle_message(self.simplemsg)

        self.assertEquals(1, self.sla.issue_set.all().count())

        notification = NotificationsBin.receive()

        self.assertEquals([FROM], notification['to'])
예제 #2
0
    def test_handle_message(self):

        handle_message(self.simplemsg)

        self.assertEquals(1, self.sla.issue_set.all().count())

        notification = NotificationsBin.receive()

        self.assertEquals([FROM], notification['to'])
    def test_handle_message_with_extended_from(self):

        handle_message(self.simplemsg)

        self.assertEquals(1, self.sla.issue_set.all().count())

        notification = NotificationsBin.receive()

        self.assertEquals([FROM], notification["to"])
        self.assertEquals(TO, notification["from"])
예제 #4
0
    def test_notify(self):

        status = Status.objects.create(name=settings.ISSUE_STATUS_CLOSED,
                                       issue=self.issue,
                                       comment="Closed!")

        status.save()

        try:
            notification = NotificationsBin.receive()
        except:
            self.fail("We should have mail!")
예제 #5
0
    def test_notify(self):

        settings.NOTIFICATION_BLACKLIST = [
            "*****@*****.**", "*****@*****.**"
        ]

        context = {
            "from": "*****@*****.**",
            "to": "*****@*****.**",
            "issue": TestIssue()
        }

        notify("issue_created", context, "*****@*****.**",
               "*****@*****.**")

        try:
            notification = NotificationsBin.receive()
            self.fail("We should not have mail!")
        except:
            pass

        notify("issue_created", context, "*****@*****.**",
               "[email protected], [email protected]")

        try:
            notification = NotificationsBin.receive()
            self.fail("We should not have mail!")
        except:
            pass

        notify("issue_created", context, "*****@*****.**",
               "[email protected], [email protected]")

        try:
            notification = NotificationsBin.receive()
        except:
            self.fail("We should have mail!")

        # reset...
        settings.NOTIFICATION_BLACKLIST = []
예제 #6
0
파일: status.py 프로젝트: teserak/mrwolfe
    def test_notify(self):

        status = Status.objects.create(
            name=settings.ISSUE_STATUS_CLOSED,
            issue=self.issue,
            comment="Closed!")

        status.save()

        try:
            notification = NotificationsBin.receive()
        except:
            self.fail("We should have mail!")
예제 #7
0
    def test_handle_message_with_attachments(self):

        handle_message(self.multipartmsg)

        self.assertEquals(1, self.sla.issue_set.all().count())

        issue = self.sla.issue_set.all()[0]

        self.assertEquals(1, issue.attachment_set.all().count())

        notification = NotificationsBin.receive()

        self.assertEquals([FROM], notification['to'])
        self.assertEquals(TO, notification['from'])
예제 #8
0
    def test_handle_message_with_attachments(self):

        handle_message(self.multipartmsg)

        self.assertEquals(1, self.sla.issue_set.all().count())

        issue = self.sla.issue_set.all()[0]

        self.assertEquals(1, issue.attachment_set.all().count())

        notification = NotificationsBin.receive()

        self.assertEquals([FROM], notification['to'])    
        self.assertEquals(TO, notification['from'])
예제 #9
0
    def test_notify(self):

        settings.NOTIFICATION_BLACKLIST = ["*****@*****.**", 
                                           "*****@*****.**"]

        context = {"from": "*****@*****.**", 
                   "to": "*****@*****.**", 
                   "issue": TestIssue()}

        notify("issue_created", context, "*****@*****.**", "*****@*****.**")

        try:
            notification = NotificationsBin.receive()
            self.fail("We should not have mail!")
        except:
            pass

        notify("issue_created", context, "*****@*****.**", 
               "[email protected], [email protected]")

        try:
            notification = NotificationsBin.receive()
            self.fail("We should not have mail!")
        except:
            pass

        notify("issue_created", context, "*****@*****.**", 
               "[email protected], [email protected]")

        try:
            notification = NotificationsBin.receive()
        except:
            self.fail("We should have mail!")

        # reset...
        settings.NOTIFICATION_BLACKLIST = []
예제 #10
0
    def test_notification(self):

        contact = Contact.objects.create(email="*****@*****.**")
        contact.save()

        issue = Issue.objects.create(
            title="broken stuff", contact=contact,
            text="Well, it's really broken")

        issue.save()

        notification = NotificationsBin.receive()

        issue_url = reverse(
            'view_issue', args=[], kwargs={'pk': issue.pk})

        self.assertTrue(issue_url in notification["body"])
예제 #11
0
    def test_handle_message_sla_with_default_service(self):

        service = Service.objects.create(sla=self.sla, priority="laag")

        self.sla.default_service = service
        self.sla.save()

        handle_message(self.simplemsg)

        self.assertEquals(1, self.sla.issue_set.all().count())

        self.assertEquals(service, self.sla.issue_set.all()[0].service)

        notification = NotificationsBin.receive()

        self.assertEquals([FROM], notification['to'])    
        self.assertEquals(TO, notification['from'])
예제 #12
0
    def test_handle_message_sla_with_default_service(self):

        service = Service.objects.create(sla=self.sla, priority="laag")

        self.sla.default_service = service
        self.sla.save()

        handle_message(self.simplemsg)

        self.assertEquals(1, self.sla.issue_set.all().count())

        self.assertEquals(service, self.sla.issue_set.all()[0].service)

        notification = NotificationsBin.receive()

        self.assertEquals([FROM], notification['to'])
        self.assertEquals(TO, notification['from'])
예제 #13
0
    def test_handle_bouncing_issue(self):

        msg = MIMEText("It's broken", 'plain')

        msg['From'] = "*****@*****.**"
        msg['To'] = "*****@*****.**"
        msg['Subject'] = "help!"

        import mrwolfe.utils as utils
        utils.settings.ALLOW_NON_CONTACTS = False

        handle_message(msg)

        self.assertEquals(0, Issue.objects.all().count())

        notification = NotificationsBin.receive()

        self.assertEquals("Invalid contact for support",
                          notification['subject'])
예제 #14
0
    def test_handle_bouncing_issue(self):

        msg = MIMEText("It's broken", 'plain')

        msg['From'] = "*****@*****.**"
        msg['To'] = "*****@*****.**"
        msg['Subject'] = "help!"

        import mrwolfe.utils as utils
        utils.settings.ALLOW_NON_CONTACTS = False

        handle_message(msg)

        self.assertEquals(0, Issue.objects.all().count())

        notification = NotificationsBin.receive()

        self.assertEquals("Invalid contact for support", 
                          notification['subject'])
예제 #15
0
    def test_handle_message_with_existing_issue(self):

        handle_message(self.simplemsg)

        self.assertEquals(1, self.sla.issue_set.all().count())

        issue = self.sla.issue_set.all()[0]

        self.simplemsg.replace_header('subject', "Re: %s" % issue.issue_id)

        handle_message(self.simplemsg)

        self.assertEquals(1, self.sla.issue_set.all().count())

        self.assertEquals(1, issue.comments.all().count())

        notification = NotificationsBin.receive()

        self.assertEquals([FROM], notification['to'])    
        self.assertEquals(TO, notification['from'])
예제 #16
0
파일: issue.py 프로젝트: teserak/mrwolfe
    def test_notification(self):

        contact = Contact.objects.create(email="*****@*****.**")
        contact.save()

        user = User.objects.create(username="******", is_superuser=False)

        Operator.objects.create(user=user, email="*****@*****.**")

        issue = Issue.objects.create(title="broken stuff",
                      contact=contact,
                      text="Well, it's really broken")

        issue.save()

        notification = NotificationsBin.receive()

        issue_url = reverse('view_issue', args=[], kwargs={'pk': issue.pk })

        self.assertTrue(issue_url in notification["body"])
예제 #17
0
    def test_handle_message_with_existing_issue(self):

        handle_message(self.simplemsg)

        self.assertEquals(1, self.sla.issue_set.all().count())

        issue = self.sla.issue_set.all()[0]

        self.simplemsg.replace_header('subject', "Re: %s" % issue.issue_id)

        handle_message(self.simplemsg)

        self.assertEquals(1, self.sla.issue_set.all().count())

        self.assertEquals(1, issue.comments.all().count())

        notification = NotificationsBin.receive()

        self.assertEquals([FROM], notification['to'])
        self.assertEquals(TO, notification['from'])