from django.test import TestCase
from compass.models import (Category,
                            Book)


class CategoryTestCase(TestCase):
    def test_can_add_category(self,):
        Category.create(title="Mock Category")
        self.assertEqual(Category.find("Mock Category").count(), 1)


class BookTestCase(TestCase):
    def test_can_add_book(self):
        category = Category.create(title="Mock Category")
        Book.create(title="Mock Book", category=category)
        self.assertEqual(Book.find("Mock Book").count(), 1)

@@ -96,16 +96,25 @@
     Book
+, Compass
 )%0A%0A%0Aclas
@@ -525,20 +525,588 @@
  Book%22).count(), 1)%0A
+%0A%0Aclass CompassTestCase(TestCase):%0A    def test_correct_title_if_not_title_and_category(self,):%0A        heading = Compass.heading(title=%22%22, category=%22%22)%0A        self.assertEqual(heading, %22All books%22)%0A%0A    def test_correct_title_if_not_category(self,):%0A        heading = Compass.heading(title=%22Title 1%22, category=%22%22)%0A        self.assertEqual(heading, %22All book titles like Title 1%22)%0A%0A    def test_correct_title_if_not_title(self,):%0A        heading = Compass.heading(title=%22%22, category=%22Category 1%22)%0A        self.assertEqual(heading, %22All book titles under Category 1%22)%0A

Test correct heading returned in search results