Пример #1
0
 def test_sprint_bugs_form_validation(self):
     # non digit
     form = SprintBugsForm(instance=self.s,
                           data={
                               'new_bugs': '1234,234d,2345',
                           })
     self.assertFalse(form.is_valid())
     # no commas
     form = SprintBugsForm(instance=self.s,
                           data={
                               'new_bugs': '12342342345',
                           })
     self.assertTrue(form.is_valid())
     # blank
     form = SprintBugsForm(instance=self.s, data={
         'new_bugs': '',
     })
     self.assertFalse(form.is_valid())
     form = SprintBugsForm(instance=self.s,
                           data={
                               'new_bugs': '1234,23465,2345',
                           })
     self.assertTrue(form.is_valid())
Пример #2
0
 def test_sprint_bug_management(self):
     self.s.update_bugs(self.p.get_backlog())
     self.s.bugs.remove(Bug.objects.get(id=665747))
     self.assertEqual(self.s.bugs.count(), 3)
     new_bug_ids = [665747, 770965, 775147]
     form = SprintBugsForm(instance=self.s,
                           data={
                               'new_bugs':
                               ','.join(str(bid) for bid in new_bug_ids),
                           })
     self.assertTrue(form.is_valid())
     form.save()
     self.assertEqual(self.s.bugs.count(), 3)
     all_bl_bug_ids = self.s.bugs.values_list('id', flat=True)
     self.assertSetEqual(set(all_bl_bug_ids), set(new_bug_ids))
Пример #3
0
 def test_sprint_bug_management(self):
     self.s.update_bugs(self.p.get_backlog())
     self.s.update_bugs(remove=[778465])
     self.assertEqual(self.s.bugs.count(), 8)
     new_bug_ids = [778465, 778466, 781717]
     form = SprintBugsForm(
         instance=self.s,
         data={
             'add_bugs':
             '778465',
             'remove_bugs':
             ','.join(
                 str(b.id)
                 for b in self.s.bugs.exclude(id__in=new_bug_ids)),
         })
     self.assertTrue(form.is_valid())
     form.save()
     self.assertEqual(self.s.bugs.count(), 3)
     all_bl_bug_ids = self.s.bugs.values_list('id', flat=True)
     self.assertSetEqual(set(all_bl_bug_ids), set(new_bug_ids))