Beispiel #1
0
class TextChangeObjectTestCase(unittest.TestCase):
    def setUp(self):
        self.change = TextChange(verbose_name='description',
                                 field=fields.CharField,
                                 change=('test1', 'test2'))

    def test_verbose_name(self):
        self.assertEqual(self.change.verbose_name, 'description')

    def test_field(self):
        self.assertEqual(self.change.field, fields.CharField)

    def test_change(self):
        self.assertEqual(self.change.change, ('test1', 'test2'))

    def test_diff_text_change(self):
        self.assertEqual(
            self.change.diff, '<del class="diff modified">test1'
            '</del><ins class="diff modified">test2</ins>\n')

    def test_render_diff(self):
        diff_operations = get_diff_operations('test1', 'test2')
        self.assertEqual(
            self.change.render_diff('moderation/html_diff.html',
                                    {'diff_operations': diff_operations}),
            '<del class="diff modified">test1'
            '</del><ins class="diff modified">test2</ins>\n')
Beispiel #2
0
class TextChangeObjectTestCase(unittest.TestCase):
    
    def setUp(self):
        self.change = TextChange(verbose_name='description',
                             field=fields.CharField,
                             change=('test1', 'test2'))
    
    def test_verbose_name(self):
        self.assertEqual(self.change.verbose_name, 'description')
        
    def test_field(self):
        self.assertEqual(self.change.field, fields.CharField)
    
    def test_change(self):
        self.assertEqual(self.change.change, ('test1', 'test2'))
    
    def test_diff_text_change(self):
        self.assertEqual(self.change.diff,
                         u'<del class="diff modified">test1'\
                         u'</del><ins class="diff modified">test2</ins>\r\n')
    
    def test_render_diff(self):
        diff_operations = get_diff_operations('test1', 'test2')
        self.assertEqual(self.change.render_diff('moderation/html_diff.html',
                        {'diff_operations': diff_operations}),
                        u'<del class="diff modified">test1'\
                        u'</del><ins class="diff modified">test2</ins>\r\n')
Beispiel #3
0
 def setUp(self):
     self.change = TextChange(verbose_name='description',
                              field=fields.CharField,
                              change=('test1', 'test2'))
Beispiel #4
0
 def setUp(self):
     self.change = TextChange(verbose_name='description',
                          field=fields.CharField,
                          change=('test1', 'test2'))