def test_favour_header_mimetype_if_no_query_mimetype():
    server_mimetypes = ['application/json', 'application/marcxml+xml']
    client_mimetypes = parse_accept_header('application/json', MIMEAccept)
    formats_map = {'json': 'application/json', 'marcxml': 'application/marcxml+xml'}
    fmt = None
    assert ('application/json' == ContentNegotiator.match(server_mimetypes, client_mimetypes, formats_map, fmt))
    formats_map = {}
    fmt = 'marcxml'
    assert ('application/json' == ContentNegotiator.match(server_mimetypes, client_mimetypes, formats_map, fmt))
def test_favour_header_mimetype_if_no_query_mimetype():
    server_mimetypes = ['application/json', 'application/marcxml+xml']
    client_mimetypes = parse_accept_header('application/json', MIMEAccept)
    formats_map = {'json': 'application/json', 'marcxml': 'application/marcxml+xml'}
    fmt = None
    assert ('application/json' == ContentNegotiator.match(server_mimetypes, client_mimetypes, formats_map, fmt))
    formats_map = {}
    fmt = 'marcxml'
    assert ('application/json' == ContentNegotiator.match(server_mimetypes, client_mimetypes, formats_map, fmt))