blob: aa467e9c5e76d52f012d614bf4edd7743c59da62 [file] [log] [blame]
from unittest import TestCase
import subprocess
import shutil
import tempfile
from util.archives import bzip2, bunzip2
class TestSigningUtils(TestCase):
def setUp(self):
self.tmpdir = tempfile.mkdtemp()
def tearDown(self):
shutil.rmtree(self.tmpdir)
def testBzip2(self):
fn = "%s/foo" % self.tmpdir
open(fn, "w").write("hello")
bzip2(fn)
proc = subprocess.Popen(["bzcat", fn], stdout=subprocess.PIPE)
self.assertEquals("hello", proc.stdout.read())
bunzip2(fn)
self.assertEquals("hello", open(fn, 'rb').read())