~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to tests/upstream_import.py

  • Committer: Aaron Bentley
  • Date: 2011-06-27 23:07:10 UTC
  • Revision ID: aaron@aaronbentley.com-20110627230710-orth0tzf1kwknfen
Better handling of compound tar names.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
    )
13
13
from bzrlib.bzrdir import BzrDir
14
14
from bzrlib.export.tar_exporter import export_tarball
 
15
from bzrlib.plugins.bzrtools import errors
15
16
from bzrlib.plugins.bzrtools.upstream_import import (
16
17
    common_directory,
 
18
    get_archive_type,
17
19
    import_archive,
18
20
    import_tar,
19
21
    import_zip,
255
257
        import_tar(tree, tar_file)
256
258
        # So long as it did not crash, that should be ok
257
259
 
 
260
    def test_get_archive_type(self):
 
261
        self.assertEqual(('tar', None), get_archive_type('foo.tar'))
 
262
        self.assertEqual(('zip', None), get_archive_type('foo.zip'))
 
263
        self.assertRaises(errors.NotArchiveType, get_archive_type, 'foo.gif')
 
264
        self.assertEqual(('tar', 'gz'), get_archive_type('foo.tar.gz'))
 
265
        self.assertRaises(errors.NotArchiveType, get_archive_type,
 
266
                          'foo.zip.gz')
 
267
        self.assertEqual(('tar', 'gz'), get_archive_type('foo.tgz'))
 
268
        self.assertEqual(('tar', 'lzma'), get_archive_type('foo.tar.lzma'))
 
269
        self.assertEqual(('tar', 'lzma'), get_archive_type('foo.tar.xz'))
 
270
        self.assertEqual(('tar', 'bz2'), get_archive_type('foo.tar.bz2'))
 
271
 
258
272
 
259
273
class TestWithStuff(TestCaseWithTransport):
260
274