예제 #1
0
 def test_strip_cfd_templates_does_nothing_when_no_templates(self):
     """Test that when there are no CFD templates, the page text is not changed."""
     bot = CategoryMoveRobot(oldcat='Old', newcat='New')
     bot.newcat.text = "Nothing should change.\n\nAnother line."
     bot._strip_cfd_templates(commit=False)
     self.assertEqual(bot.newcat.text,
                      "Nothing should change.\n\nAnother line.")
 def test_strip_cfd_templates_does_nothing_when_no_templates(self):
     """Test that when there are no CFD templates, the page text is not changed."""
     bot = CategoryMoveRobot(oldcat='Old', newcat='New')
     bot.newcat.text = "Nothing should change.\n\nAnother line."
     bot._strip_cfd_templates(commit=False)
     self.assertEqual(bot.newcat.text,
                      "Nothing should change.\n\nAnother line.")
예제 #3
0
 def _runtest_strip_cfd_templates(self, template_start, template_end):
     """Run a CFD template stripping test with the given CFD start/end templates."""
     bot = CategoryMoveRobot(oldcat='Old', newcat='New')
     bot.newcat.text = '\n'.join(
         ('Preamble', template_start, 'Random text inside template',
          'Even another template: {{cfr-speedy}}', template_end,
          'Footer stuff afterwards', '', '[[Category:Should remain]]'))
     expected = '\n'.join(('Preamble', 'Footer stuff afterwards', '',
                           '[[Category:Should remain]]'))
     bot._strip_cfd_templates(commit=False)
     self.assertEqual(bot.newcat.text, expected)
 def _runtest_strip_cfd_templates(self, template_start, template_end):
     """Run a CFD template stripping test with the given CFD start/end templates."""
     bot = CategoryMoveRobot(oldcat="Old", newcat="New")
     bot.newcat.text = "\n".join(
         (
             "Preamble",
             template_start,
             "Random text inside template",
             "Even another template: {{cfr-speedy}}",
             template_end,
             "Footer stuff afterwards",
             "",
             "[[Category:Should remain]]",
         )
     )
     expected = "\n".join(("Preamble", "Footer stuff afterwards", "", "[[Category:Should remain]]"))
     bot._strip_cfd_templates(commit=False)
     self.assertEqual(bot.newcat.text, expected)
 def _runtest_strip_cfd_templates(self, template_start, template_end):
     """Run a CFD template stripping test with the given CFD start/end templates."""
     bot = CategoryMoveRobot(oldcat='Old', newcat='New')
     bot.newcat.text = '\n'.join((
         'Preamble',
         template_start,
         'Random text inside template',
         'Even another template: {{cfr-speedy}}',
         template_end,
         'Footer stuff afterwards',
         '',
         '[[Category:Should remain]]'
     ))
     expected = '\n'.join((
         'Preamble',
         'Footer stuff afterwards',
         '',
         '[[Category:Should remain]]'
     ))
     bot._strip_cfd_templates(commit=False)
     self.assertEqual(bot.newcat.text, expected)