Exemplo n.º 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'])
Exemplo n.º 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"])
Exemplo n.º 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!")
Exemplo n.º 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 = []
Exemplo n.º 6
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!")
Exemplo n.º 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'])
Exemplo n.º 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'])
Exemplo n.º 9
0
    def setUp(self):

        NotificationsBin.clear()

        sla = SLA.objects.create(name="RoadMap",
                                 start_date="2012-01-01",
                                 end_date="2012-12-31")
        
        service =sla.service_set.create(response_time=2,
                                        solution_time=4,
                                        priority="normal")

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

        self.issue = Issue(title="broken stuff",
                           contact=contact,
                           service=service,
                           text="Well, it's broken",
                           created=datetime.now(),
                           sla=sla)

        self.issue.save()
Exemplo n.º 10
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 = []
Exemplo n.º 11
0
    def setUp(self):

        NotificationsBin.clear()

        sla = SLA.objects.create(name="RoadMap",
                                 start_date="2012-01-01",
                                 end_date="2012-12-31")

        service = sla.service_set.create(response_time=2,
                                         solution_time=4,
                                         priority="normal")

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

        self.issue = Issue(title="broken stuff",
                           contact=contact,
                           service=service,
                           text="Well, it's broken",
                           created=datetime.now(),
                           sla=sla)

        self.issue.save()
Exemplo n.º 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'])
Exemplo n.º 13
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"])
Exemplo n.º 14
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'])
Exemplo n.º 15
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'])
Exemplo n.º 16
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'])
Exemplo n.º 17
0
    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"])
Exemplo n.º 18
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'])
Exemplo n.º 19
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'])
Exemplo n.º 20
0
    def setUp(self):

        NotificationsBin.clear()
        user = User.objects.create(username="******", is_superuser=False)
        Operator.objects.create(user=user, email="*****@*****.**")
Exemplo n.º 21
0
    def setUp(self):

        NotificationsBin.clear()
Exemplo n.º 22
0
    def setUp(self):

        NotificationsBin.clear()