def test_beetmover_template_args_generation(context, taskjson, partials):
    context.task = get_fake_valid_task(taskjson)
    expected_template_args = {
        "branch": "mozilla-central",
        "filename_platform": "android-arm",
        "product": "Fake",
        "stage_platform": "android-api-15",
        "platform": "android-api-15",
        "template_key": "fake_nightly",
        "upload_date": "2016/09/2016-09-01-16-26-14",
        "version": "99.0a1",
        "buildid": "20990205110000",
        "partials": partials,
        "locales": ["en-US"],
    }

    template_args = generate_beetmover_template_args(context)
    assert template_args == expected_template_args

    context.task["payload"]["locale"] = "en-US"
    context.task["payload"]["upstreamArtifacts"][0]["locale"] = "en-US"
    expected_template_args["template_key"] = "fake_nightly"
    expected_template_args["locales"] = ["en-US"]
    template_args = generate_beetmover_template_args(context)
    assert template_args == expected_template_args
Beispiel #2
0
def test_beetmover_template_args_generation(context, taskjson, partials):
    context.task = get_fake_valid_task(taskjson)
    expected_template_args = {
        'branch': 'mozilla-central',
        'filename_platform': 'android-arm',
        'product': 'Fake',
        'stage_platform': 'android-api-15',
        'platform': 'android-api-15',
        'template_key': 'fake_nightly',
        'upload_date': '2016/09/2016-09-01-16-26-14',
        'version': '99.0a1',
        'buildid': '20990205110000',
        'partials': partials,
        'locales': ['en-US'],
    }

    template_args = generate_beetmover_template_args(context)
    assert template_args == expected_template_args

    context.task['payload']['locale'] = 'en-US'
    context.task['payload']['upstreamArtifacts'][0]['locale'] = 'en-US'
    expected_template_args['template_key'] = 'fake_nightly'
    expected_template_args['locales'] = ['en-US']
    template_args = generate_beetmover_template_args(context)
    assert template_args == expected_template_args
Beispiel #3
0
def test_beetmover_template_args_generation():
    context = Context()
    context.task = get_fake_valid_task()
    context.config = get_fake_valid_config()
    context.properties = get_fake_balrog_props()["properties"]
    context.properties['platform'] = context.properties['stage_platform']

    expected_template_args = {
        'branch': 'mozilla-central',
        'platform': 'android-api-15',
        'product': 'Fake',
        'stage_platform': 'android-api-15',
        'template_key': 'fennec_nightly',
        'upload_date': '2016/09/2016-09-01-16-26-14',
        'version': '99.0a1'
    }

    template_args = generate_beetmover_template_args(context.task,
                                                     context.properties)
    assert template_args == expected_template_args

    context.task['payload']['locale'] = 'ro'
    template_args = generate_beetmover_template_args(context.task,
                                                     context.properties)

    assert template_args['template_key'] == 'fake_nightly_repacks'
Beispiel #4
0
def test_beetmover_template_args_fennec_nightly(context):
    """Ensure that fennec which is en-US and multi don't get the repack template"""
    context.task = get_fake_valid_task('task_fennec.json')
    template_args = generate_beetmover_template_args(context)
    assert 'locale' not in template_args
    assert template_args['locales'] == ['en-US', 'multi']
    assert template_args['template_key'] == 'fake_nightly'
def test_beetmover_template_args_fennec_nightly(context):
    """Ensure that fennec which is en-US and multi don't get the repack template"""
    context.task = get_fake_valid_task("task_fennec.json")
    template_args = generate_beetmover_template_args(context)
    assert "locale" not in template_args
    assert template_args["locales"] == ["en-US", "multi"]
    assert template_args["template_key"] == "fake_nightly"
Beispiel #6
0
def test_beetmover_template_args_maven(context, branch, version, artifact_id,
                                       build_id, expected_version, raises):
    context.bucket = 'maven'
    context.action = 'push-to-maven'
    context.task['payload']['version'] = version
    context.task['payload']['artifact_id'] = artifact_id
    context.release_props['branch'] = branch
    context.release_props['buildid'] = build_id
    context.release_props['appName'] = 'geckoview'

    if not raises:
        assert generate_beetmover_template_args(context) == {
            'artifact_id': artifact_id,
            'template_key': 'maven_geckoview',
            'version': expected_version,
        }
    else:
        with pytest.raises(TaskVerificationError):
            generate_beetmover_template_args(context)
def test_beetmover_template_args_maven(product, context, branch, version, artifact_id, build_id, expected_version, raises):
    context.bucket = "maven"
    context.action = "push-to-maven"
    context.task["payload"]["version"] = version
    context.task["payload"]["artifact_id"] = artifact_id
    context.release_props["branch"] = branch
    context.release_props["buildid"] = build_id
    context.release_props["appName"] = product

    if not raises:
        assert generate_beetmover_template_args(context) == {
            "artifact_id": artifact_id,
            "template_key": "maven_{}".format(product),
            "is_jar": None,
            "version": expected_version,
        }
    else:
        with pytest.raises(TaskVerificationError):
            generate_beetmover_template_args(context)
def test_beetmover_template_args_generation_release_is_jar(context):
    context.bucket = "dep"
    context.action = "push-to-maven"
    context.task["payload"]["version"] = "0.26.0"
    context.task["payload"]["artifact_id"] = "fenix-megazord-forUnitTests"
    context.task["payload"]["is_jar"] = True

    expected_template_args = {"artifact_id": "fenix-megazord-forUnitTests", "is_jar": True, "template_key": "maven_Fake", "version": "0.26.0"}

    template_args = generate_beetmover_template_args(context)
    assert template_args == expected_template_args
Beispiel #9
0
def test_beetmover_template_args_locales(context, payload, expected_locales):
    context.task = get_fake_valid_task('task_partials.json')
    context.task['payload'] = payload
    context.task['payload']['upload_date'] = '2018/04/2018-04-09-15-30-00'

    template_args = generate_beetmover_template_args(context)
    if expected_locales:
        assert 'locale' not in template_args    # locale used to be the old way of filling locale
        assert template_args['locales'] == expected_locales
    else:
        assert 'locale' not in template_args
        assert 'locales' not in template_args
def test_beetmover_template_args_locales(context, payload, expected_locales):
    context.task = get_fake_valid_task("task_partials.json")
    context.task["payload"] = payload
    context.task["payload"]["upload_date"] = "2018/04/2018-04-09-15-30-00"

    template_args = generate_beetmover_template_args(context)
    if expected_locales:
        assert "locale" not in template_args  # locale used to be the old way of filling locale
        assert template_args["locales"] == expected_locales
    else:
        assert "locale" not in template_args
        assert "locales" not in template_args
def test_beetmover_template_args_generation_release_is_jar(context):
    context.bucket = 'dep'
    context.action = 'push-to-maven'
    context.task['payload']['version'] = '0.26.0'
    context.task['payload']['artifact_id'] = 'fenix-megazord-forUnitTests'
    context.task['payload']['is_jar'] = True

    expected_template_args = {
        'artifact_id': 'fenix-megazord-forUnitTests',
        'is_jar': True,
        'template_key': 'maven_Fake',
        'version': '0.26.0',
    }

    template_args = generate_beetmover_template_args(context)
    assert template_args == expected_template_args
Beispiel #12
0
def test_beetmover_template_args_maven(context, branch, version, artifact_id,
                                       build_id, expected_version):
    context.bucket = 'maven'
    context.action = 'push-to-maven'
    context.task['payload']['version'] = version
    context.task['payload']['artifact_id'] = artifact_id
    context.release_props['branch'] = branch
    context.release_props['buildid'] = build_id
    context.release_props['appName'] = 'geckoview'

    assert generate_beetmover_template_args(context) == {
        'artifact_id': artifact_id,
        'branch': branch,
        'product': 'geckoview',
        'template_key': 'maven_geckoview',
        'version': expected_version,
        'buildid': build_id,
    }
Beispiel #13
0
def test_beetmover_template_args_maven_snapshot(context, branch, version, artifact_id,
                                                expected_version):
    context.bucket = 'maven'
    context.action = 'push-to-maven'
    context.task['payload']['version'] = version
    context.task['payload']['artifact_id'] = artifact_id
    context.release_props['branch'] = branch
    # there's inherited buildid here from the context fixture
    del context.release_props['buildid']
    context.release_props['appName'] = 'geckoview'

    assert generate_beetmover_template_args(context) == {
        'artifact_id': artifact_id,
        'template_key': 'maven_geckoview',
        'version': expected_version,
        'snapshot_version': version,
        'date_timestamp': '{{date_timestamp}}',
        'clock_timestamp': '{{clock_timestamp}}',
        'build_number': '{{build_number}}'
    }
def test_beetmover_template_args_maven_snapshot(product, context, branch, version, artifact_id, expected_version):
    context.bucket = "maven"
    context.action = "push-to-maven"
    context.task["payload"]["version"] = version
    context.task["payload"]["artifact_id"] = artifact_id
    context.release_props["branch"] = branch
    # there's inherited buildid here from the context fixture
    del context.release_props["buildid"]
    context.release_props["appName"] = product

    assert generate_beetmover_template_args(context) == {
        "artifact_id": artifact_id,
        "template_key": "maven_{}".format(product),
        "version": expected_version,
        "snapshot_version": version,
        "is_jar": None,
        "date_timestamp": "{{date_timestamp}}",
        "clock_timestamp": "{{clock_timestamp}}",
        "build_number": "{{build_number}}",
    }
Beispiel #15
0
def test_beetmover_template_args_generation_release(context):
    context.bucket = 'dep'
    context.action = 'push-to-candidates'
    context.task['payload']['build_number'] = 3
    context.task['payload']['version'] = '4.4'

    expected_template_args = {
        'branch': 'mozilla-central',
        'product': 'Fake',
        'filename_platform': 'android-arm',
        'stage_platform': 'android-api-15',
        'platform': 'android-api-15',
        'template_key': 'fake_candidates',
        'upload_date': '2016/09/2016-09-01-16-26-14',
        'version': '4.4',
        'buildid': '20990205110000',
        'partials': {},
        'build_number': 3,
        'locales': ['en-US'],
    }

    template_args = generate_beetmover_template_args(context)
    assert template_args == expected_template_args
def test_beetmover_template_args_generation_release(context):
    context.bucket = "dep"
    context.action = "push-to-candidates"
    context.task["payload"]["build_number"] = 3
    context.task["payload"]["version"] = "4.4"

    expected_template_args = {
        "branch": "mozilla-central",
        "product": "Fake",
        "filename_platform": "android-arm",
        "stage_platform": "android-api-15",
        "platform": "android-api-15",
        "template_key": "fake_candidates",
        "upload_date": "2016/09/2016-09-01-16-26-14",
        "version": "4.4",
        "buildid": "20990205110000",
        "partials": {},
        "build_number": 3,
        "locales": ["en-US"],
    }

    template_args = generate_beetmover_template_args(context)
    assert template_args == expected_template_args