Example #1
0
def test_get_latest_snapshot_version():
    """Integration test to make sure we can get the latest snapshot (library and sources)
    jars for an ST project that we've uploaded to the OSS instance of Artifactory that JFrog
    runs.
    """
    from stac.api import new_maven_client
    client = new_maven_client(ARTIFACTORY_INSTANCE, SNAPSHOT_REPO, is_snapshot=True)

    latest_version = client.get_latest_version('com.smartertravel.metrics.aop.st-metrics')
    latest_jar = client.get_version_url('com.smartertravel.metrics.aop.st-metrics', 'jar', latest_version)
    print(latest_jar)

    assert latest_jar.startswith(
        ARTIFACTORY_INSTANCE + '/' + SNAPSHOT_REPO + '/com/smartertravel/metrics/aop/st-metrics')
    assert latest_jar.endswith('.jar')

    latest_sources = client.get_version_url(
        'com.smartertravel.metrics.aop.st-metrics', 'jar', latest_version, descriptor='sources')
    print(latest_sources)

    assert latest_sources.startswith(
        ARTIFACTORY_INSTANCE + '/' + SNAPSHOT_REPO + '/com/smartertravel/metrics/aop/st-metrics')
    assert latest_sources.endswith('-sources.jar')
Example #2
0
def test_get_latest_snapshot_versions():
    """Integration test to make sure we can get the latest snapshots (library and sources)
    jars for an ST project that we've uploaded to the OSS instance of Artifactory that JFrog
    runs.
    """
    from stac.api import new_maven_client
    client = new_maven_client(ARTIFACTORY_INSTANCE, SNAPSHOT_REPO, is_snapshot=True)

    latest_versions = client.get_latest_versions('com.smartertravel.metrics.aop.st-metrics')
    latest_jars = [
        client.get_version_url('com.smartertravel.metrics.aop.st-metrics', 'jar', version)
        for version in latest_versions]
    print(latest_jars)

    assert isinstance(latest_jars, list), "Expected list result from latest versions jar call"
    assert 1 <= len(latest_jars)

    latest_sources = [
        client.get_version_url('com.smartertravel.metrics.aop.st-metrics', 'jar', version, descriptor='sources')
        for version in latest_versions]
    print(latest_sources)

    assert isinstance(latest_sources, list), "Expected list result from latest versions sources call"
    assert 1 <= len(latest_sources)