def test_GetPackageMetadata_downgrade(self): target_info_dict = copy.deepcopy(self.TEST_TARGET_INFO_DICT) source_info_dict = copy.deepcopy(self.TEST_SOURCE_INFO_DICT) self._test_GetPackageMetadata_swapBuildTimestamps( target_info_dict, source_info_dict) target_info = common.BuildInfo(target_info_dict, None) source_info = common.BuildInfo(source_info_dict, None) common.OPTIONS.incremental_source = '' common.OPTIONS.downgrade = True common.OPTIONS.wipe_user_data = True metadata = GetPackageMetadata(target_info, source_info) self.assertDictEqual( { 'ota-downgrade' : 'yes', 'ota-type' : 'BLOCK', 'ota-wipe' : 'yes', 'post-build' : 'build-fingerprint-target', 'post-build-incremental' : 'build-version-incremental-target', 'post-sdk-level' : '27', 'post-security-patch-level' : '2017-12-01', 'post-timestamp' : '1400000000', 'pre-device' : 'product-device', 'pre-build' : 'build-fingerprint-source', 'pre-build-incremental' : 'build-version-incremental-source', }, metadata)
def test_GetPackageMetadata_nonAbOta_full(self): target_info = BuildInfo(self.TEST_TARGET_INFO_DICT, None) metadata = GetPackageMetadata(target_info) self.assertDictEqual( { 'ota-type': 'BLOCK', 'post-build': 'build-fingerprint-target', 'post-build-incremental': 'build-version-incremental-target', 'post-sdk-level': '27', 'post-security-patch-level': '2017-12-01', 'post-timestamp': '1500000000', 'pre-device': 'product-device', }, metadata)
def test_GetPackageMetadata_retrofitDynamicPartitions(self): target_info = common.BuildInfo(self.TEST_TARGET_INFO_DICT, None) common.OPTIONS.retrofit_dynamic_partitions = True metadata = GetPackageMetadata(target_info) self.assertDictEqual( { 'ota-retrofit-dynamic-partitions' : 'yes', 'ota-type' : 'BLOCK', 'post-build' : 'build-fingerprint-target', 'post-build-incremental' : 'build-version-incremental-target', 'post-sdk-level' : '27', 'post-security-patch-level' : '2017-12-01', 'post-timestamp' : '1500000000', 'pre-device' : 'product-device', }, metadata)
def test_GetPackageMetadata_abOta_full(self): target_info_dict = copy.deepcopy(self.TEST_TARGET_INFO_DICT) target_info_dict['ab_update'] = 'true' target_info = BuildInfo(target_info_dict, None) metadata = GetPackageMetadata(target_info) self.assertDictEqual( { 'ota-type': 'AB', 'ota-required-cache': '0', 'post-build': 'build-fingerprint-target', 'post-build-incremental': 'build-version-incremental-target', 'post-sdk-level': '27', 'post-security-patch-level': '2017-12-01', 'post-timestamp': '1500000000', 'pre-device': 'product-device', }, metadata)