Esempio n. 1
0
class TestImage(TestCase):
    def setUp(self):
        from pycdstar.media import Image

        with NamedTemporaryFile(delete=False, suffix='.jpg') as fp:
            fp.write(b"""test""")
            self.file = Image(fp.name)

    def test_create_object(self):
        class subprocess(object):
            def check_call(self, args):
                with open(args[-1], 'w') as fp:
                    fp.write(b'test' if PY2 else 'test')
                return

            def check_output(self, args):
                return 'path JPEG 3x5 more'

        with patch('pycdstar.media.subprocess', subprocess()):
            self.file.create_object(Mock())

    def tearDown(self):
        if os.path.exists(self.file.path):
            os.remove(self.file.path)
Esempio n. 2
0
    def setUp(self):
        from pycdstar.media import Image

        with NamedTemporaryFile(delete=False, suffix='.jpg') as fp:
            fp.write(b"""test""")
            self.file = Image(fp.name)