~ubuntu-branches/ubuntu/utopic/mutagen/utopic-proposed

« back to all changes in this revision

Viewing changes to tests/test_tools_moggsplit.py

  • Committer: Package Import Robot
  • Author(s): Daniel T Chen
  • Date: 2013-11-27 22:10:48 UTC
  • mfrom: (8.1.17 sid)
  • Revision ID: package-import@ubuntu.com-20131127221048-ae2f5j42ak2ox3kw
Tags: 1.22-1ubuntu1
* Merge from Debian unstable.  Remaining changes:
  - debian/control: Drop faad and oggz-tools build dependencies (in
    universe).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import os
 
2
from tempfile import mkstemp
 
3
import shutil
 
4
 
 
5
from tests import add
 
6
from tests.test_tools import _TTools
 
7
 
 
8
 
 
9
class TMOggSPlit(_TTools):
 
10
 
 
11
    TOOL_NAME = "moggsplit"
 
12
 
 
13
    def setUp(self):
 
14
        super(TMOggSPlit, self).setUp()
 
15
        original = os.path.join('tests', 'data', 'multipagecomment.ogg')
 
16
        fd, self.filename = mkstemp(suffix='.ogg')
 
17
        os.close(fd)
 
18
        shutil.copy(original, self.filename)
 
19
 
 
20
        # append the second file
 
21
        first = open(self.filename, "ab")
 
22
        to_append = os.path.join('tests', 'data', 'multipage-setup.ogg')
 
23
        second = open(to_append, "rb")
 
24
        first.write(second.read())
 
25
        second.close()
 
26
        first.close()
 
27
 
 
28
    def tearDown(self):
 
29
        super(TMOggSPlit, self).tearDown()
 
30
        os.unlink(self.filename)
 
31
 
 
32
    def test_basic(self):
 
33
        d = os.path.dirname(self.filename)
 
34
        p = os.path.join(d, "%(stream)d.%(ext)s")
 
35
        res, out = self.call("--pattern", p, self.filename)
 
36
        self.failIf(res)
 
37
        self.failIf(out)
 
38
 
 
39
        for stream in [1002429366, 1806412655]:
 
40
            stream_path = os.path.join(d, str(stream) + ".ogg")
 
41
            self.failUnless(os.path.exists(stream_path))
 
42
            os.unlink(stream_path)
 
43
 
 
44
add(TMOggSPlit)