def generate_balrog_info(context, artifact_pretty_name, locale, destinations, from_buildid=None): release_props = context.release_props checksums = context.checksums url = "{prefix}/{s3_key}".format(prefix=get_bucket_url_prefix(context), s3_key=destinations[0]) data = { "hash": checksums[artifact_pretty_name][release_props["hashType"]], "size": checksums[artifact_pretty_name]["size"], "url": url } if from_buildid: data["from_buildid"] = from_buildid if is_promotion_action(context.action): partials = get_partials_props(context.task) for p in partials.values(): if p["buildid"] == str(from_buildid): data["previousVersion"] = p["previousVersion"] data["previousBuildNumber"] = p["previousBuildNumber"] break return data
def test_get_partials_props(taskjson, expected): partials_props = get_partials_props(get_fake_valid_task(taskjson)) assert partials_props == expected