Пример #1
0
 def test_check_notifications_mailing(self):
     mailing_info = get_mailing_info()
     call_command('check_notifications')
     self.assertEqual(len(mail.outbox), len(mailing_info))
     mailing_info = get_mailing_info()
     for user in self.users:
         self.assertEqual(mailing_info[user.username][NEW_TICKETS], set([]))
         self.assertEqual(mailing_info[user.username][LEFT_TICKETS], set([]))
Пример #2
0
 def test_left_tickets(self):
     mailing_info = get_mailing_info()
     call_command('check_notifications')
     changed_tickets = {}
     for user in self.users:
         random_ticket = random.choice(list(mailing_info[user.username][NEW_TICKETS]))
         changed_tickets[user.username] = random_ticket
         ticket = trac_models.Ticket.objects.get(id=random_ticket)
         ticket.milestone = MILESTONE_08
         ticket.save()
     mailing_info = get_mailing_info()
     for user in self.users:
         self.assertTrue(mailing_info[user.username][LEFT_TICKETS])
Пример #3
0
 def test_new_tickets_in_not_notificated(self):
     nn = get_mailing_info()
     for user in self.users:
         new_tickets_count = nn[user.username][NEW_TICKETS]
         user_project_tickets = len(get_user_tickets(user, only_notification=True))
         self.assertEqual(
             len(new_tickets_count),
             user_project_tickets
         )
Пример #4
0
    def test_new_tickets(self):
        call_command('check_notifications')
        new_tickets_count = random.randint(1, 10)
        for i in range(new_tickets_count):
            self._generate_ticket(MILESTONE_09, self.get_ticket_number())
        mailing_info = get_mailing_info()
        milestone_09_users = [user for user in self.users if user in get_user_milestones(user, only_notification=True)]

        for user in milestone_09_users:
            self.assertEqual(len(mailing_info[user.username].get(NEW_TICKETS)), new_tickets_count)