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)
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)
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', '')
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', '')
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_')
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_')