Example #1
0
def test_get_license_from_url_nones_invalid_license():
    path_map = {'by/1.0': {'license': 'by', 'version': '1.0'}}
    actual_license, actual_version = util._get_license_from_url(
        'http://creativecommons.org/licenses/ba/1.0/',
        path_map=path_map
    )
    expect_license, expect_version = None, None
    assert actual_license == expect_license
    assert actual_version == expect_version
Example #2
0
def test_get_license_from_url_finds_info_from_allcaps_path():
    path_map = {
        'by/1.0': {'license': 'by', 'version': '1.0'},
        'cc0/1.0': {'license': 'cc0', 'version': '1.0'}
    }
    actual_license, actual_version = util._get_license_from_url(
        'http://creativecommons.org/licenses/CC0/1.0/legalcode',
        path_map=path_map
    )
    expect_license, expect_version = 'cc0', '1.0'
    assert actual_license == expect_license
    assert actual_version == expect_version
Example #3
0
def test_get_license_from_url_finds_correct_nonstandard_info():
    path_map = {
        'by/1.0': {'license': 'by', 'version': '1.0'},
        'zero/1.0': {'license': 'cc0', 'version': '1.0'}
    }
    actual_license, actual_version = util._get_license_from_url(
        'http://creativecommons.org/publicdomain/zero/1.0/',
        path_map=path_map
    )
    expect_license, expect_version = 'cc0', '1.0'
    assert actual_license == expect_license
    assert actual_version == expect_version
Example #4
0
def test_get_license_from_url_nones_missing_url():
    actual_license, actual_version = util._get_license_from_url(None)
    expect_license, expect_version = None, None
    assert actual_license == expect_license
    assert actual_version == expect_version