Ejemplo n.º 1
0
    def test_get_entry_base_model(self):
        entry_models.ENTRY_BASE_MODEL = ''
        self.assertEquals(get_entry_base_model(), AbstractEntry)

        entry_models.ENTRY_BASE_MODEL = 'mymodule.myclass'
        with warnings.catch_warnings(record=True) as w:
            self.assertEquals(get_entry_base_model(), AbstractEntry)
            self.assertTrue(issubclass(w[-1].category, RuntimeWarning))

        entry_models.ENTRY_BASE_MODEL = 'zinnia.models.entry.AbstractEntry'
        self.assertEquals(get_entry_base_model(), AbstractEntry)
Ejemplo n.º 2
0
    def test_get_entry_base_model(self):
        entry_models.ENTRY_BASE_MODEL = ''
        self.assertEquals(get_entry_base_model(), AbstractEntry)

        entry_models.ENTRY_BASE_MODEL = 'mymodule.myclass'
        with warnings.catch_warnings(record=True) as w:
            self.assertEquals(get_entry_base_model(), AbstractEntry)
            self.assertTrue(issubclass(w[-1].category, RuntimeWarning))

        entry_models.ENTRY_BASE_MODEL = 'zinnia.models.entry.AbstractEntry'
        self.assertEquals(get_entry_base_model(), AbstractEntry)
Ejemplo n.º 3
0
    def test_get_entry_base_model(self):
        entry.ENTRY_BASE_MODEL = ''
        self.assertEquals(get_entry_base_model(), EntryAbstractClass)

        entry.ENTRY_BASE_MODEL = 'mymodule.myclass'
        try:
            with warnings.catch_warnings(record=True) as w:
                self.assertEquals(get_entry_base_model(), EntryAbstractClass)
                self.assertTrue(issubclass(w[-1].category, RuntimeWarning))
        except AttributeError:
            # Fail under Python2.5, because of'warnings.catch_warnings'
            pass

        entry.ENTRY_BASE_MODEL = 'zinnia.models.entry.EntryAbstractClass'
        self.assertEquals(get_entry_base_model(), EntryAbstractClass)