コード例 #1
0
 def test_get_category_by_slug(self):
     """
     Can get a category by its slug.
     """
     self.assertIsInstance(
         Category.lookup_by_slug('yellow-ones'),
         Category)
コード例 #2
0
    def test_category_location_relationship(self):
        """
        Category has a lookup relationship to Location objects.
        """
        category = Category.lookup_slugs(['old-ones'])[0]

        for location in category.locations:
            self.assertIsInstance(location, Location)

        if not category.locations:
            self.fail('No locations found')