예제 #1
0
def test_flatten_scan_key_ordering():
    test_json = test_env.get_test_loc('csv/flatten_scan/key_order.json')
    scan = load_scan(test_json)
    headers = OrderedDict([
        ('info', []),
        ('license', []),
        ('copyright', []),
        ('email', []),
        ('url', []),
        ('package', []),
        ])
    result = list(flatten_scan(scan, headers))
    expected_file = test_env.get_test_loc('csv/flatten_scan/key_order.expected.json')
    check_json(result, expected_file)
예제 #2
0
def test_flatten_scan_can_process_package_license_when_license_value_is_null():
    test_json = test_env.get_test_loc('csv/flatten_scan/package_license_value_null.json')
    scan = load_scan(test_json)
    headers = OrderedDict([
        ('info', []),
        ('license', []),
        ('copyright', []),
        ('email', []),
        ('url', []),
        ('package', []),
        ])
    result = list(flatten_scan(scan, headers))
    expected_file = test_env.get_test_loc('csv/flatten_scan/package_license_value_null.json-expected')
    check_json(result, expected_file)
예제 #3
0
def test_flatten_scan_can_process_path_with_and_without_leading_slash():
    test_json = test_env.get_test_loc('csv/flatten_scan/path_with_and_without_leading_slash.json')
    scan = load_scan(test_json)
    headers = OrderedDict([
        ('info', []),
        ('license', []),
        ('copyright', []),
        ('email', []),
        ('url', []),
        ('package', []),
        ])
    result = list(flatten_scan(scan, headers))
    expected_file = test_env.get_test_loc('csv/flatten_scan/path_with_and_without_leading_slash.json-expected')
    check_json(result, expected_file)
예제 #4
0
def test_flatten_scan_minimal():
    test_json = test_env.get_test_loc('csv/flatten_scan/minimal.json')
    scan = load_scan(test_json)
    headers = dict([
        ('info', []),
        ('license', []),
        ('copyright', []),
        ('email', []),
        ('url', []),
        ('package', []),
    ])
    result = list(flatten_scan(scan, headers))
    expected_file = test_env.get_test_loc(
        'csv/flatten_scan/minimal.json-expected')
    check_json(result, expected_file)
예제 #5
0
def test_flatten_scan_with_no_keys_does_not_error_out():
    # this scan has no results at all
    test_json = test_env.get_test_loc('csv/flatten_scan/no_keys.json')
    scan = load_scan(test_json)
    headers = dict([
        ('info', []),
        ('license', []),
        ('copyright', []),
        ('email', []),
        ('url', []),
        ('package', []),
    ])
    result = list(flatten_scan(scan, headers))
    expected_headers = dict([
        ('info', []),
        ('license', []),
        ('copyright', []),
        ('email', []),
        ('url', []),
        ('package', []),
    ])
    assert headers == expected_headers
    assert result == []