コード例 #1
0
ファイル: tests.py プロジェクト: nimbis/mezzanine
    def test_get_subclass_queries_helper_base(self):
        """
        Test base case of get_subclass_queries_helper
        """
        # We pass it a relation of a class that has no descendents
        # We use "Link" for this
        r, = [x for x in get_subclass_relations(Page) if x.var_name == 'link']

        result = get_subclass_queries_helper(r, 'test__')
        self.assertEqual(result, ['test__link'])
コード例 #2
0
ファイル: tests.py プロジェクト: nimbis/mezzanine
 def test_get_subclass_queries_helper_induction(self):
     """
     Test the recursive case of get_subclass_queries_helper, where there are
     descendants
     """
     r, = [x for x in get_subclass_relations(Page)
           if x.var_name == 'richtextpage']
     result = get_subclass_queries_helper(r, 'test__')
     self.assertIn('test__richtextpage__foopage', result)
     self.assertIn('test__richtextpage__barpage', result)
コード例 #3
0
ファイル: tests.py プロジェクト: nimbis/mezzanine
 def test_get_subclass_relations(self):
     """
     Test the get_subclass_relations function
     """
     relations = get_subclass_relations(Page)
     # Create a set of pairs with relation info
     set_of_pairs = set((x.var_name, x.model) for x in relations)
     self.assertIn(('richtextpage', RichTextPage), set_of_pairs)
     self.assertIn(('link', Link), set_of_pairs)
     self.assertIn(('form', Form), set_of_pairs)
     self.assertIn(('gallery', Gallery), set_of_pairs)