示例#1
0
 def testRejectsVersionFile(self):
     """Rejects obsolete --version-file."""
     with self.assertRaises(SystemExit):
         sign_image.main([
             '--type', 'badtype', '-i', self.infile, '--keyset-dir',
             '/keydir', '-o', self.outfile, '--version-file', 'key.versions'
         ])
     self.assertEqual(0, self.sign_mock.call_count)
示例#2
0
 def testBadType(self):
     """Fails with bad image_type."""
     with self.assertRaises(SystemExit):
         sign_image.main([
             '--type', 'badtype', '-i', self.infile, '--keyset-dir',
             '/keydir', '-o', self.outfile
         ])
     self.assertEqual(0, self.sign_mock.call_count)
示例#3
0
 def testUsb(self):
     """Signs image_type=usb."""
     self.assertEqual(
         0,
         sign_image.main([
             '--type', 'usb', '-i', self.infile, '--keyset-dir', '/keydir',
             '-o', self.outfile
         ]))
     self.sign_mock.assert_called_once_with('USB', self.infile,
                                            self.outfile, 2, '/keydir', '')
示例#4
0
 def testBase(self):
     """Signs image_type=base."""
     self.assertEqual(
         0,
         sign_image.main([
             '--type', 'base', '-i', self.infile, '--keyset-dir', '/keydir',
             '-o', self.outfile
         ]))
     self.sign_mock.assert_called_once_with('SSD', self.infile,
                                            self.outfile, 2, '/keydir', '')
示例#5
0
 def testInstall(self):
     """Signs image_type=install."""
     self.assertEqual(
         0,
         sign_image.main([
             '--type', 'install', '-i', self.infile, '--keyset-dir',
             '/keydir', '-o', self.outfile
         ]))
     self.sign_mock.assert_called_once_with('factory_install', self.infile,
                                            self.outfile, 2, '/keydir',
                                            'installer_')
示例#6
0
 def testRecovery(self):
     """Signs image_type=recovery."""
     self.assertEqual(
         0,
         sign_image.main([
             '--type', 'recovery', '-i', self.infile, '--keyset-dir',
             '/keydir', '-o', self.outfile
         ]))
     self.sign_mock.assert_called_once_with('recovery', self.infile,
                                            self.outfile, 4, '/keydir',
                                            'recovery_')