def test_ads_links_returns_empty_string_when_record_has_no_name():
    without_name = {}

    expected = ''
    result = ads_links(without_name)

    assert expected == result
Esempio n. 2
0
def test_ads_links_builds_link_from_full_name():
    with_full_name = {'name': {'value': 'Ellis, John R.'}}

    expected = 'http://adsabs.harvard.edu/cgi-bin/author_form?author=Ellis,+J&fullauthor=Ellis,+John+R.'
    result = ads_links(with_full_name)

    assert expected == result
Esempio n. 3
0
def test_ads_links_returns_empty_string_when_record_has_no_name():
    without_name = {}

    expected = ''
    result = ads_links(without_name)

    assert expected == result
def test_ads_links_builds_link_from_full_name():
    with_full_name = {
        'name': {'value': 'Ellis, John R.'}
    }

    expected = 'http://adsabs.harvard.edu/cgi-bin/author_form?author=Ellis,+J&fullauthor=Ellis,+John+R.'
    result = ads_links(with_full_name)

    assert expected == result
Esempio n. 5
0
def test_ads_links_uses_preferred_name_when_name_has_no_lastname():
    without_last_name = InspireRecord(
        {'name': {
            'value': ', John R.',
            'preferred_name': 'Ellis, John R.'
        }})

    expected = 'http://adsabs.harvard.edu/cgi-bin/author_form?author=Ellis, John R.'
    result = ads_links(without_last_name)

    assert expected == result
def test_ads_links_uses_preferred_name_when_name_has_no_lastname():
    without_last_name = {
        'name': {
            'value': ', John R.',
            'preferred_name': 'Ellis, John R.'
        }
    }

    expected = 'http://adsabs.harvard.edu/cgi-bin/author_form?author=Ellis, John R.'
    result = ads_links(without_last_name)

    assert expected == result