예제 #1
0
 def test_process_firmware_image_asks_not_to_upload_firmware_file(
         self, get_extractor_mock):
     # | GIVEN |
     get_extractor_mock.return_value.extract.return_value = (
         'core_fw_file.bin', True)
     self.client.model = 'Gen8'
     # | WHEN |
     raw_fw_file, to_upload, is_extracted = (utils.process_firmware_image(
         self.some_compact_fw_file, self.client))
     # | THEN |
     self.assertEqual('core_fw_file.bin', raw_fw_file)
     self.assertFalse(to_upload)
예제 #2
0
 def test_process_firmware_image_calls_extract_of_fw_extractor_object(
         self, get_extractor_mock):
     # process_firmware_image calls extract on the firmware_extractor
     # instance
     # | GIVEN |
     get_extractor_mock.return_value.extract.return_value = (
         'core_fw_file.bin', True)
     # | WHEN |
     raw_fw_file, to_upload, is_extracted = (utils.process_firmware_image(
         self.some_compact_fw_file, self.client))
     # | THEN |
     get_extractor_mock.assert_called_once_with(self.some_compact_fw_file)
     get_extractor_mock.return_value.extract.assert_called_once_with()
예제 #3
0
 def test_process_firmware_image_asks_to_upload_firmware_file_Gen10(
         self, get_extractor_mock):
     # if fw_version is greater than or equal to 2.0
     # | GIVEN |
     get_extractor_mock.return_value.extract.return_value = (
         'core_fw_file.bin', True)
     self.client.model = 'Gen10'
     # | WHEN |
     raw_fw_file, to_upload, is_extracted = (utils.process_firmware_image(
         self.some_compact_fw_file, self.client))
     # | THEN |
     self.assertEqual('core_fw_file.bin', raw_fw_file)
     self.assertTrue(to_upload)
예제 #4
0
 def test_process_firmware_image_asks_not_to_upload_firmware_file(
         self, get_extractor_mock):
     # | GIVEN |
     get_extractor_mock.return_value.extract.return_value = (
         'core_fw_file.bin', True)
     self.client.model = 'Gen8'
     # | WHEN |
     raw_fw_file, to_upload, is_extracted = (
         utils.process_firmware_image(self.some_compact_fw_file,
                                      self.client))
     # | THEN |
     self.assertEqual('core_fw_file.bin', raw_fw_file)
     self.assertFalse(to_upload)
예제 #5
0
 def test_process_firmware_image_asks_to_upload_firmware_file(
         self, get_extractor_mock):
     # if fw_version is greater than or equal to 2.0
     # | GIVEN |
     get_extractor_mock.return_value.extract.return_value = (
         'core_fw_file.bin', True)
     self.client.model = 'Gen9'
     # | WHEN |
     raw_fw_file, to_upload, is_extracted = (
         utils.process_firmware_image(self.some_compact_fw_file,
                                      self.client))
     # | THEN |
     self.assertEqual('core_fw_file.bin', raw_fw_file)
     self.assertTrue(to_upload)
예제 #6
0
 def test_process_firmware_image_calls_extract_of_fw_extractor_object(
         self, get_extractor_mock):
     # process_firmware_image calls extract on the firmware_extractor
     # instance
     # | GIVEN |
     get_extractor_mock.return_value.extract.return_value = (
         'core_fw_file.bin', True)
     # | WHEN |
     raw_fw_file, to_upload, is_extracted = (
         utils.process_firmware_image(self.some_compact_fw_file,
                                      self.client))
     # | THEN |
     get_extractor_mock.assert_called_once_with(self.some_compact_fw_file)
     get_extractor_mock.return_value.extract.assert_called_once_with()