コード例 #1
0
 def test_BugTaskCommandGroup_add(self):
     # BugEmailCommands can be added to the group.
     command_1 = BugEmailCommands.get('affects', ['fnord'])
     command_2 = BugEmailCommands.get('status', ['triaged'])
     group = BugTaskCommandGroup()
     group.add(command_1)
     group.add(command_2)
     self.assertEqual([command_1, command_2], group._commands)
コード例 #2
0
 def test_BugTaskCommandGroup_add(self):
     # BugEmailCommands can be added to the group.
     command_1 = BugEmailCommands.get('affects', ['fnord'])
     command_2 = BugEmailCommands.get('status', ['triaged'])
     group = BugTaskCommandGroup()
     group.add(command_1)
     group.add(command_2)
     self.assertEqual([command_1, command_2], group._commands)
コード例 #3
0
 def test_BugTaskCommandGroup__str__(self):
     # The str of a BugTaskCommandGroup is the ideal order of the
     # text commands in the email.
     command_1 = BugEmailCommands.get('affects', ['fnord'])
     command_2 = BugEmailCommands.get('status', ['triaged'])
     group = BugTaskCommandGroup()
     group.add(command_1)
     group.add(command_2)
     self.assertEqual('affects fnord\nstatus triaged', str(group))
コード例 #4
0
 def test_BugTaskCommandGroup__str__(self):
     # The str of a BugTaskCommandGroup is the ideal order of the
     # text commands in the email.
     command_1 = BugEmailCommands.get('affects', ['fnord'])
     command_2 = BugEmailCommands.get('status', ['triaged'])
     group = BugTaskCommandGroup()
     group.add(command_1)
     group.add(command_2)
     self.assertEqual(
         'affects fnord\nstatus triaged', str(group))
コード例 #5
0
 def test_BugCommandGroup_groups(self):
     # The groups property returns a copy _groups list in the order that
     # that they were added.
     bugtask_group_1 = BugTaskCommandGroup(
         BugEmailCommands.get('affects', ['fnord']))
     group = BugCommandGroup()
     group.add(bugtask_group_1)
     bugtask_group_2 = BugTaskCommandGroup(
         BugEmailCommands.get('affects', ['pting']))
     group.add(bugtask_group_2)
     self.assertEqual(group._groups, group.groups)
     self.assertFalse(group._groups is group.groups)
     self.assertEqual([bugtask_group_1, bugtask_group_2], group.groups)
コード例 #6
0
 def test_BugTaskCommandGroup_sorted_commands(self):
     # Commands are sorted by the Command's Rank.
     command_3 = BugEmailCommands.get('importance', ['low'])
     command_2 = BugEmailCommands.get('status', ['triaged'])
     command_1 = BugEmailCommands.get('affects', ['fnord'])
     group = BugTaskCommandGroup()
     group.add(command_3)
     group.add(command_2)
     group.add(command_1)
     self.assertEqual(0, command_1.RANK)
     self.assertEqual(4, command_2.RANK)
     self.assertEqual(5, command_3.RANK)
     self.assertEqual(
         [command_1, command_2, command_3], group.commands)
コード例 #7
0
 def test_BugCommandGroup_groups_new_bug_with_fixable_affects(self):
     # A new bug that affects only one target does not require the
     # affects command to be first.
     group = BugCommandGroup(BugEmailCommands.get('bug', ['new']))
     status_command = BugEmailCommands.get('status', ['triaged'])
     bugtask_group_1 = BugTaskCommandGroup(status_command)
     group.add(bugtask_group_1)
     affects_command = BugEmailCommands.get('affects', ['fnord'])
     bugtask_group_2 = BugTaskCommandGroup(affects_command)
     group.add(bugtask_group_2)
     self.assertEqual(1, len(group.groups))
     self.assertIsNot(group._groups, group.groups,
                      "List reference returned instead of copy.")
     self.assertEqual([affects_command, status_command],
                      group.groups[0].commands)
コード例 #8
0
 def test_BugCommandGroup_add_bugtask_empty_group(self):
     # Empty BugTaskCommandGroups are ignored.
     bugtask_group = BugTaskCommandGroup()
     group = BugCommandGroup()
     group.add(bugtask_group)
     self.assertEqual([], group._commands)
     self.assertEqual([], group._groups)
コード例 #9
0
 def test_BugCommandGroup__nonzero__true_groups(self):
     # A BugCommandGroup is not zero is it has a group.
     group = BugCommandGroup()
     group.add(
         BugTaskCommandGroup(BugEmailCommands.get('affects', ['fnord'])))
     self.assertEqual(0, len(group._commands))
     self.assertEqual(1, len(group._groups))
     self.assertTrue(bool(group))
コード例 #10
0
 def test_BugCommandGroup_add_bugtask_non_empty_group(self):
     # Non-empty BugTaskCommandGroups are added.
     bugtask_group = BugTaskCommandGroup(
         BugEmailCommands.get('affects', ['fnord']))
     group = BugCommandGroup()
     group.add(bugtask_group)
     self.assertEqual([], group._commands)
     self.assertEqual([bugtask_group], group._groups)
コード例 #11
0
 def test_BugCommandGroup__str__(self):
     # The str of a BugCommandGroup is the ideal order of the
     # text commands in the email.
     bug_group = BugCommandGroup(BugEmailCommands.get('private', ['true']))
     bug_group.add(BugEmailCommands.get('security', ['false']))
     bugtask_group = BugTaskCommandGroup(
         BugEmailCommands.get('affects', ['fnord']))
     bug_group.add(bugtask_group)
     self.assertEqual('security false\nprivate true\naffects fnord',
                      str(bug_group))
コード例 #12
0
 def test_BugTaskCommandGroup_sorted_commands(self):
     # Commands are sorted by the Command's Rank.
     command_3 = BugEmailCommands.get('importance', ['low'])
     command_2 = BugEmailCommands.get('status', ['triaged'])
     command_1 = BugEmailCommands.get('affects', ['fnord'])
     group = BugTaskCommandGroup()
     group.add(command_3)
     group.add(command_2)
     group.add(command_1)
     self.assertEqual(0, command_1.RANK)
     self.assertEqual(4, command_2.RANK)
     self.assertEqual(5, command_3.RANK)
     self.assertEqual([command_1, command_2, command_3], group.commands)
コード例 #13
0
 def test_BugTaskCommandGroup__nonzero__false(self):
     # A BugTaskCommandGroup is zero is it has no commands.
     group = BugTaskCommandGroup()
     self.assertEqual(0, len(group._commands))
     self.assertFalse(bool(group))
コード例 #14
0
 def test_BugTaskCommandGroup_init_with_command(self):
     # BugTaskCommandGroup can be inited with a BugEmailCommands.
     command = BugEmailCommands.get('status', ['triaged'])
     group = BugTaskCommandGroup(command)
     self.assertEqual([command], group._commands)