def test_create_firmware_from_file(): test_object = Firmware() test_object.create_from_file('{}/test_data_file.bin'.format(get_test_data_dir())) assert test_object.device_name is None assert test_object.size == 19 assert test_object.binary == b'test string in file' assert test_object.sha256 == '268d870ffa2b21784e4dc955d8e8b8eb5f3bcddd6720a1e6d31d2cf84bd1bff8' assert test_object.file_name == 'test_data_file.bin'
def test_create_firmware_from_file(self): test_object = Firmware() test_object.create_from_file('{}/test_data_file.bin'.format(get_test_data_dir())) self.assertEqual(test_object.device_name, None, 'correct device name') self.assertEqual(test_object.size, 19, 'correct size') self.assertEqual(test_object.binary, b'test string in file', 'correct binary data') self.assertEqual(test_object.sha256, '268d870ffa2b21784e4dc955d8e8b8eb5f3bcddd6720a1e6d31d2cf84bd1bff8', 'correct sha256') self.assertEqual(test_object.file_name, 'test_data_file.bin', 'correct file name')