mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-04-16 04:51:01 +00:00
Added test for replace_text command
This commit is contained in:
parent
e9ce499d5a
commit
86969e9df3
2 changed files with 18 additions and 1 deletions
|
|
@ -24,7 +24,7 @@ class Command(BaseCommand):
|
|||
revision.save(update_fields=['content_json'])
|
||||
|
||||
for content_type in get_page_types():
|
||||
print "scanning %s" % content_type.name
|
||||
self.stdout.write("scanning %s" % content_type.name)
|
||||
page_class = content_type.model_class()
|
||||
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -841,3 +841,20 @@ class TestMovePagesCommand(TestCase):
|
|||
# Check that all pages moved
|
||||
for page_id in page_ids:
|
||||
self.assertEqual(Page.objects.get(id=page_id).get_parent(), about_us)
|
||||
|
||||
|
||||
class TestReplaceTextCommand(TestCase):
|
||||
fixtures = ['test.json']
|
||||
|
||||
def run_command(self, from_text, to_text):
|
||||
management.call_command('replace_text', from_text, to_text, interactive=False, stdout=StringIO())
|
||||
|
||||
def test_replace_text(self):
|
||||
# Check that the christmas page is definitely about christmas
|
||||
self.assertEqual(Page.objects.get(url_path='/home/events/christmas/').title, "Christmas")
|
||||
|
||||
# Make it about easter
|
||||
self.run_command("Christmas", "Easter")
|
||||
|
||||
# Check that its now about easter
|
||||
self.assertEqual(Page.objects.get(url_path='/home/events/christmas/').title, "Easter")
|
||||
|
|
|
|||
Loading…
Reference in a new issue