def test_render_conferences_handles_unicode(request_context):
    hits = Response({
        'hits': {
            'hits': [
                {
                    '_type': 'conference',
                    '_source': {
                        'address': [
                            {'original_address': 'Paris, France'},
                        ],
                        'control_number': 1351301,
                        'titles': [
                            {'title': u'Théorie de Cordes en France'},
                        ],
                    },
                },
            ],
            'total': 1,
        },
    }).hits

    expected = ([
        [
            u'<a href="/conferences/1351301">Théorie de Cordes en France</a>',
            'Paris, France',
            '',
            u'  ',
        ],
    ], 1)
    result = render_conferences(1, hits)

    assert expected == result
Esempio n. 2
0
def test_render_conferences(request_context):
    hits = Response(
        Search(), {
            'hits': {
                'hits': [
                    {
                        '_type': 'conferences',
                        '_source': {
                            'addresses': [
                                {
                                    'original_address': 'original_address'
                                },
                            ],
                            'control_number':
                            1,
                            'titles': [
                                {
                                    'title': 'title'
                                },
                            ],
                        },
                    },
                    {
                        '_type': 'conferences',
                        '_source': {
                            'control_number': 2,
                        },
                    },
                ],
                'total':
                2,
            },
        }).hits

    expected = ([
        [
            '<a href="/conferences/1">title</a>',
            'original_address',
            '',
            u'  ',
        ],
    ], 1)
    result = render_conferences(2, hits)

    assert expected == result
def test_render_conferences(request_context):
    hits = Response(
        Search(),
        {
            'hits': {
                'hits': [
                    {
                        '_type': 'conferences',
                        '_source': {
                            'address': [
                                {'original_address': 'original_address'},
                            ],
                            'control_number': 1,
                            'titles': [
                                {'title': 'title'},
                            ],
                        },
                    },
                    {
                        '_type': 'conferences',
                        '_source': {
                            'control_number': 2,
                        },
                    },
                ],
                'total': 2,
            },
        }
    ).hits

    expected = ([
        [
            '<a href="/conferences/1">title</a>',
            'original_address',
            '',
            u'  ',
        ],
    ], 1)
    result = render_conferences(2, hits)

    assert expected == result
Esempio n. 4
0
def test_render_conferences_handles_unicode(request_context):
    hits = Response(
        Search(), {
            'hits': {
                'hits': [
                    {
                        '_type': 'conference',
                        '_source': {
                            'addresses': [
                                {
                                    'original_address': 'Paris, France'
                                },
                            ],
                            'control_number':
                            1351301,
                            'titles': [
                                {
                                    'title': u'Théorie de Cordes en France'
                                },
                            ],
                        },
                    },
                ],
                'total':
                1,
            },
        }).hits

    expected = ([
        [
            u'<a href="/conferences/1351301">Théorie de Cordes en France</a>',
            'Paris, France',
            '',
            u'  ',
        ],
    ], 1)
    result = render_conferences(1, hits)

    assert expected == result