예제 #1
0
def test_only_returns_approved_datasets():
    response = clean_output(API_OUTPUT)

    assert len(response) == 2
    publishers = [
        response[0]['publisher']['name'], response[1]['publisher']['name']
    ]
    assert 'A B Charitable Trust' in publishers
    assert 'ARCADIA' not in publishers
    assert 'Barrow Cadbury Trust' in publishers
예제 #2
0
def test_correct_output():
    response = clean_output(API_OUTPUT)[0]

    expected_response = {
        "title":
        'Open Programme grants awarded from 2015 until February 2018',
        "description":
        "",
        "identifier":
        'a001p00000zgyHZAAY',
        "license":
        'https://creativecommons.org/licenses/by/4.0/',
        "license_name":
        'Creative Commons Attribution 4.0 International (CC BY 4.0)',
        "issued":
        '2018-06-21',
        "modified":
        '2018-08-03T10:26:35.000+0000',
        "publisher": {
            "name": 'A B Charitable Trust',
            "website": 'http://abcharitabletrust.org.uk/',
            "logo": "",
            "prefix": "360G-ABCT",
            "last_published": "2021-12-13",
            "org_id": "GB-CHC-1000147",
        },
        "distribution": [{
            "downloadURL":
            'http://abcharitabletrust.org.uk/data/abct-data-february-2018.xlsx',
            "accessURL":
            'http://abcharitabletrust.org.uk/awards.htm',
            "title":
            'Open Programme grants awarded from 2015 until February 2018'
        }]
    }

    assert len(response) == 9
    assert response == expected_response
예제 #3
0
def test_website_returns_empty_string_if_none():
    response = clean_output(API_OUTPUT)[1]

    assert response['publisher']['website'] == ''
예제 #4
0
def test_logo_returns_empty_string_if_none():
    response = clean_output(API_OUTPUT)[0]

    assert response['publisher']['logo'] == ''
예제 #5
0
def test_description_returns_empty_string_if_none():
    response = clean_output(API_OUTPUT)[0]

    assert response['description'] == ''