Exemple #1
0
    def test_01_simple_content_type_creation(self):
        self.assertEqual(ExampleCMSBase.content_type_for(FileContent), None)

        ExampleCMSBase.create_content_type(ContactFormContent)
        ExampleCMSBase.create_content_type(FileContent, regions=('region2',))

        ExampleCMSBase.create_content_type(RawContent)
        ExampleCMSBase.create_content_type(RichTextContent)

        # test creating a cotent with arguments, but no initialize_type
        # classmethod
        ExampleCMSBase.create_content_type(
            VideoContent,
            arbitrary_arg='arbitrary_value')

        # content_type_for should return None if it does not have a subclass
        # registered
        self.assertEqual(ExampleCMSBase.content_type_for(Empty), None)

        self.assertTrue(
            'filecontent' not in dict(
                ExampleCMSBase.template.regions[0].content_types).keys())
        self.assertTrue(
            'filecontent' in dict(
                ExampleCMSBase.template.regions[1].content_types).keys())
Exemple #2
0
    def test_10_content_type_subclasses(self):
        """
        See:
        https://github.com/feincms/feincms/issues/339
        """
        ExampleCMSBase.create_content_type(SubRawContent)
        ExampleCMSBase.create_content_type(RawContent)

        ct = ExampleCMSBase.content_type_for(RawContent)
        ct2 = ExampleCMSBase.content_type_for(SubRawContent)
        self.assertNotEqual(ct, ct2)
Exemple #3
0
    def test_10_content_type_subclasses(self):
        """
        See:
        https://github.com/feincms/feincms/issues/339
        """
        ExampleCMSBase.create_content_type(SubRawContent)
        ExampleCMSBase.create_content_type(RawContent)

        ct = ExampleCMSBase.content_type_for(RawContent)
        ct2 = ExampleCMSBase.content_type_for(SubRawContent)
        self.assertNotEqual(ct, ct2)
Exemple #4
0
    def test_01_simple_content_type_creation(self):
        self.assertEqual(ExampleCMSBase.content_type_for(RawContent), None)

        ExampleCMSBase.create_content_type(RawContent, regions=('main2', ))
        ExampleCMSBase.create_content_type(RichTextContent)

        # content_type_for should return None if it does not have a subclass
        # registered
        self.assertEqual(ExampleCMSBase.content_type_for(Empty), None)

        self.assertTrue('rawcontent' not in dict(
            ExampleCMSBase.template.regions[0].content_types).keys())
Exemple #5
0
    def test_01_simple_content_type_creation(self):
        self.assertEqual(ExampleCMSBase.content_type_for(RawContent), None)

        ExampleCMSBase.create_content_type(RawContent, regions=('main2',))
        ExampleCMSBase.create_content_type(RichTextContent)

        # content_type_for should return None if it does not have a subclass
        # registered
        self.assertEqual(ExampleCMSBase.content_type_for(Empty), None)

        self.assertTrue(
            'rawcontent' not in dict(
                ExampleCMSBase.template.regions[0].content_types).keys())
Exemple #6
0
    def test_08_creating_two_content_types_in_same_application(self):
        ExampleCMSBase.create_content_type(RawContent)
        ct = ExampleCMSBase.content_type_for(RawContent)
        self.assertEqual(ct._meta.db_table, "testapp_examplecmsbase_rawcontent")

        ExampleCMSBase2.create_content_type(RawContent, class_name="RawContent2")
        ct2 = ExampleCMSBase2.content_type_for(RawContent)
        self.assertEqual(ct2._meta.db_table, "testapp_examplecmsbase2_rawcontent2")
Exemple #7
0
    def test_06_videocontent(self):
        type = ExampleCMSBase.content_type_for(VideoContent)
        obj = type()
        obj.video = 'http://www.youtube.com/watch?v=zmj1rpzDRZ0'

        self.assertTrue('x-shockwave-flash' in obj.render())

        self.assertEqual(getattr(type, 'arbitrary_arg'), 'arbitrary_value')

        obj.video = 'http://www.example.com/'

        self.assertTrue(obj.video in obj.render())
Exemple #8
0
    def test_06_videocontent(self):
        type = ExampleCMSBase.content_type_for(VideoContent)
        obj = type()
        obj.video = 'http://www.youtube.com/watch?v=zmj1rpzDRZ0'

        self.assertTrue('x-shockwave-flash' in obj.render())

        self.assertEqual(getattr(type, 'arbitrary_arg'), 'arbitrary_value')

        obj.video = 'http://www.example.com/'

        self.assertTrue(obj.video in obj.render())
Exemple #9
0
    def test_01_simple_content_type_creation(self):
        self.assertEqual(ExampleCMSBase.content_type_for(FileContent), None)

        ExampleCMSBase.create_content_type(ContactFormContent)
        ExampleCMSBase.create_content_type(FileContent, regions=('region2', ))

        ExampleCMSBase.create_content_type(RawContent)
        ExampleCMSBase.create_content_type(RichTextContent)

        # test creating a cotent with arguments, but no initialize_type
        # classmethod
        ExampleCMSBase.create_content_type(VideoContent,
                                           arbitrary_arg='arbitrary_value')

        # content_type_for should return None if it does not have a subclass
        # registered
        self.assertEqual(ExampleCMSBase.content_type_for(Empty), None)

        self.assertTrue('filecontent' not in dict(
            ExampleCMSBase.template.regions[0].content_types).keys())
        self.assertTrue('filecontent' in dict(
            ExampleCMSBase.template.regions[1].content_types).keys())