old_contents: from django.test import TestCase
  import json
  from wagtail.wagtailcore.models import Page
  from django.contrib.auth.models import User
  from .models import BlogIndexPage, BlogPage
  from .management.commands.wordpress_to_wagtail import Command
  
  
  class BlogTests(TestCase):
      def setUp(self):
          home = Page.objects.get(slug='home')
          self.user = User.objects.create_user('test', 'test@test.test', 'pass')
          self.blog_index = home.add_child(instance=BlogIndexPage(
              title='Blog Index', slug='blog', search_description="x",
              owner=self.user
          ))
  
      def test_import(self):
          command = Command()
          with open('test-data.json') as test_json:
              posts = json.load(test_json)
          command.create_blog_pages(posts, self.blog_index)
          self.assertEquals(Page.objects.all().count(), 4)
          self.assertEquals(BlogPage.objects.all().count(), 1)
          page = BlogPage.objects.get()
          self.assertEqual(page.title, "My wordpress title")
          self.assertInHTML("<strong>Bold here</strong>", page.body)
          self.assertTrue("media" in page.body)
  
new_contents: from django.test import TestCase
  import json
  from django.contrib.comments import Comment
  from wagtail.wagtailcore.models import Page
  from django.contrib.auth.models import User
  from .models import BlogIndexPage, BlogPage
  from .management.commands.wordpress_to_wagtail import Command
  
  
  class BlogTests(TestCase):
      def setUp(self):
          home = Page.objects.get(slug='home')
          self.user = User.objects.create_user('test', 'test@test.test', 'pass')
          self.blog_index = home.add_child(instance=BlogIndexPage(
              title='Blog Index', slug='blog', search_description="x",
              owner=self.user
          ))
  
      def test_import(self):
          command = Command()
          with open('test-data.json') as test_json:
              posts = json.load(test_json)
          command.create_blog_pages(posts, self.blog_index)
          self.assertEquals(Page.objects.all().count(), 4)
          self.assertEquals(BlogPage.objects.all().count(), 1)
          page = BlogPage.objects.get()
          self.assertEqual(page.title, "My wordpress title")
          self.assertInHTML("<strong>Bold here</strong>", page.body)
          self.assertTrue("media" in page.body)
  <<<<<<< HEAD
  =======
          self.assertEqual(page.categories.count(), 2)
          self.assertEqual(page.tags.count(), 11)
          self.assertEqual(page.owner.id, 2)
          self.assertEqual(BlogCategory.objects.all().count(), 2)
          self.assertEqual(BlogTag.objects.all().count(), 11)
          self.assertEqual(BlogPageBlogCategory.objects.all().count(), 2)
          self.assertEqual(BlogPageTag.objects.all().count(), 11)
          parent_category = BlogCategory.objects.get(slug="writing-wisdom")
          child_category = BlogCategory.objects.get(slug="swoon-reads")
          self.assertEqual(child_category.parent, parent_category)
          self.assertEqual(child_category.slug, "swoon-reads")
          self.assertEqual(parent_category.slug, "writing-wisdom")        
          comments = Comment.objects.all()
          self.assertEqual(comments.count(), 2)        
  
          
  >>>>>>> 983d450... added failing test to check that comments are imported
  
subject: comment tests