コード例 #1
0
class PageLayoutModelTest(unittest.TestCase):
    """
    Test the behavior of the internals of the PageLayout class (including
    the behavior of PageLayoutMeta).
    """
    def setUp(self):
        self.page_layout_instance = PageLayout()
        self.test_layout = TestHomepageLayout
        self.test_layout_instance = self.test_layout()
        self.test_layout_instance_get = TestListingPageLayout()

    def test_initialization(self):
        self.assertTrue(isinstance(
            pagemanager.pagemanager_site,
            pagemanager.sites.PageManagerSite
        ))

    def test_get_thumbnail(self):
        self.assertTrue(self.page_layout_instance.get_thumbnail() == None)
        self.assertTrue(self.test_layout_instance.get_thumbnail() == \
            'pagemanager/homepage.jpg')
        self.assertTrue(self.test_layout_instance_get.get_thumbnail() == \
            'listing.jpg')

    def test_get_template_file(self):
        self.assertTrue(self.page_layout_instance.get_template_name() == None)
        self.assertTrue(self.test_layout_instance.get_template_name() == \
            'pagemanager/homepage.html')
        self.assertTrue(self.test_layout_instance_get.get_template_name() == \
            'listing.html')

    def test_get_context_data(self):
        self.assertTrue(self.page_layout_instance.get_context_data() == None)
        self.assertTrue(self.test_layout_instance.get_context_data() == \
            {'foo': 'bar'})
        self.assertTrue(self.test_layout_instance_get.get_context_data() == \
            {'foo': 'listing'})

    def _test_get_components(self):
        # FIXME: What was this supposed to do?
        self.assertTrue(self.page_layout_instance.get_components() == None)
        self.assertTrue(self.test_layout_instance.get_components() == \
            ['blog', 'news'])
        self.assertTrue(self.test_layout_instance_get.get_components() == \
            ['listing'])
コード例 #2
0
class PageLayoutModelTest(unittest.TestCase):
    """
    Test the behavior of the internals of the PageLayout class (including
    the behavior of PageLayoutMeta).
    """
    def setUp(self):
        self.page_layout_instance = PageLayout()
        self.test_layout = TestHomepageLayout
        self.test_layout_instance = self.test_layout()
        self.test_layout_instance_get = TestListingPageLayout()

    def test_initialization(self):
        self.assertTrue(
            isinstance(pagemanager.pagemanager_site,
                       pagemanager.sites.PageManagerSite))

    def test_get_thumbnail(self):
        self.assertTrue(self.page_layout_instance.get_thumbnail() == None)
        self.assertTrue(self.test_layout_instance.get_thumbnail() == \
            'pagemanager/homepage.jpg')
        self.assertTrue(self.test_layout_instance_get.get_thumbnail() == \
            'listing.jpg')

    def test_get_template_file(self):
        self.assertTrue(self.page_layout_instance.get_template_name() == None)
        self.assertTrue(self.test_layout_instance.get_template_name() == \
            'pagemanager/homepage.html')
        self.assertTrue(self.test_layout_instance_get.get_template_name() == \
            'listing.html')

    def test_get_context_data(self):
        self.assertTrue(self.page_layout_instance.get_context_data() == None)
        self.assertTrue(self.test_layout_instance.get_context_data() == \
            {'foo': 'bar'})
        self.assertTrue(self.test_layout_instance_get.get_context_data() == \
            {'foo': 'listing'})
コード例 #3
0
ファイル: tests.py プロジェクト: Threespot/django-pagemanager
 def setUp(self):
     self.page_layout_instance = PageLayout()
     self.test_layout = TestHomepageLayout
     self.test_layout_instance = self.test_layout()
     self.test_layout_instance_get = TestListingPageLayout()
コード例 #4
0
 def setUp(self):
     self.page_layout_instance = PageLayout()
     self.test_layout = TestHomepageLayout
     self.test_layout_instance = self.test_layout()
     self.test_layout_instance_get = TestListingPageLayout()