test_graph.py 937 Bytes
Newer Older
Yusei Tahara's avatar
Yusei Tahara committed
1 2 3 4 5 6 7 8 9 10 11 12 13
from Products.Archetypes.tests.atsitetestcase import ATSiteTestCase

from utils import input_file_path
FILE_PATH = input_file_path("demo1.pdf")

class TestGraph(ATSiteTestCase):

    def afterSetUp(self):
        ATSiteTestCase.afterSetUp(self)
        self.engine = self.portal.portal_transforms

    def testGraph(self):
        data = open(FILE_PATH, 'r').read()
14 15 16 17 18 19 20 21 22 23
        requirements = self.engine._policies.get('text/plain', [])
        if requirements:
            out = self.engine.convertTo('text/plain', data, filename=FILE_PATH)
            self.failUnless(out.getData())

    def testIdentity(self):
        orig = 'Some text'
        converted = self.engine.convertTo(
            'text/plain', 'Some text', mimetype='text/plain')
        self.assertEquals(orig, str(converted))
Yusei Tahara's avatar
Yusei Tahara committed
24 25 26 27 28 29 30


def test_suite():
    from unittest import TestSuite, makeSuite
    suite = TestSuite()
    suite.addTest(makeSuite(TestGraph))
    return suite