예제 #1
0
def test_map_is_shown_at():
    """MissouriMapper gets isShownAt from location url for object in context"""
    provider_data = {
        'location': {
            'url': [
                {
                    '#text': 'http://digital.wustl.edu/example',
                    'access': 'object in context'
                },
                {
                    '#text': 'http://digital.wustl.edu/example.gif',
                    'access': 'preview'
                },
                'Bogus value to test robustness',
                {
                    '#text': 'another hypothetical test',
                    'something': 'test'
                }
            ]
        }
    }
    mm = MissouriMapper(provider_data)
    mm.map_is_shown_at()
    expected = {
        'sourceResource': {},
        'isShownAt': 'http://digital.wustl.edu/example'
    }
    assert_equals(expected, mm.mapped_data)
    provider_data = {
        'location': [
            {
                'xmlns:default': 'http://www.loc.gov/mods/v3',
                'url': 'http://fraser.stlouisfed.org/publication/?pid=1272'
            },
            {
                'url': {
                    '#text': 'http://fraser.stlouisfed.org/example',
                    'access': 'object in context'
                }
            }
        ]
    }
    mm = MissouriMapper(provider_data)
    mm.map_is_shown_at()
    expected = {
        'sourceResource': {},
        'isShownAt': 'http://fraser.stlouisfed.org/example'
    }
    assert_equals(expected, mm.mapped_data)
예제 #2
0
def test_map_is_shown_at():
    """MissouriMapper gets isShownAt from location url for object in context"""
    provider_data = {
        'location': {
            'url': [{
                '#text': 'http://digital.wustl.edu/example',
                'access': 'object in context'
            }, {
                '#text': 'http://digital.wustl.edu/example.gif',
                'access': 'preview'
            }, 'Bogus value to test robustness', {
                '#text': 'another hypothetical test',
                'something': 'test'
            }]
        }
    }
    mm = MissouriMapper(provider_data)
    mm.map_is_shown_at()
    expected = {
        'sourceResource': {},
        'isShownAt': 'http://digital.wustl.edu/example'
    }
    assert_equals(expected, mm.mapped_data)
    provider_data = {
        'location': [{
            'xmlns:default':
            'http://www.loc.gov/mods/v3',
            'url':
            'http://fraser.stlouisfed.org/publication/?pid=1272'
        }, {
            'url': {
                '#text': 'http://fraser.stlouisfed.org/example',
                'access': 'object in context'
            }
        }]
    }
    mm = MissouriMapper(provider_data)
    mm.map_is_shown_at()
    expected = {
        'sourceResource': {},
        'isShownAt': 'http://fraser.stlouisfed.org/example'
    }
    assert_equals(expected, mm.mapped_data)