3 from base_test import DakTestCase
5 from dak.copy_installer import InstallerCopier
9 class ImportTestCase(DakTestCase):
10 def test_arguments(self):
11 '''test constructor arguments'''
12 # version argument is required
13 self.assertRaises(KeyError, InstallerCopier)
15 copier = InstallerCopier(version = '20110106')
16 self.assertEqual('20110106', copier.version)
17 self.assertEqual('unstable', copier.source)
18 self.assertEqual('testing', copier.dest)
20 copier = InstallerCopier(version = '20110106', source = \
22 self.assertEqual('proposed-updates', copier.source)
24 copier = InstallerCopier(version = '20110106', dest = 'stable')
25 self.assertEqual('stable', copier.dest)
27 def test_dir_names(self):
28 copier = InstallerCopier(version = '20110106')
29 self.assertEqual('tests/fixtures/ftp/dists/unstable/main',
31 self.assertEqual('tests/fixtures/ftp/dists/testing/main',
34 def missing_source(self):
35 copier = InstallerCopier(version = '20110106', source = 'foo')
37 def missing_dest(self):
38 copier = InstallerCopier(version = '20110106', dest = 'bar')
40 def test_suites(self):
41 self.assertRaises(IOError, self.missing_source)
42 self.assertRaises(IOError, self.missing_dest)
45 copier = InstallerCopier(version = '20110106')
46 self.assertEqual(['amd64'], copier.architectures)
47 self.assertEqual(['i386'], copier.skip_architectures)
49 [('tests/fixtures/ftp/dists/unstable/main/installer-amd64/20110106', \
50 'tests/fixtures/ftp/dists/testing/main/installer-amd64/20110106'),], \
52 self.assertEqual([('20110106', \
53 'tests/fixtures/ftp/dists/testing/main/installer-amd64/current')], \
54 copier.symlinks_to_create)
56 Will copy installer version 20110106 from suite unstable to
58 Architectures to copy: amd64
59 Architectures to skip: i386''', copier.get_message())
61 if __name__ == '__main__':