def test_choose_provided_and_accepted_mimetype():
    server_mimetypes = ['application/json', 'application/marcxml+xml']
    client_mimetypes = parse_accept_header('text/plain,application/json,*/*', MIMEAccept)
    assert ('application/json' == ContentNegotiator.match_by_accept(server_mimetypes, client_mimetypes))
    client_mimetypes = parse_accept_header('text/plain,application/marcxml+xml,*/*', MIMEAccept)
    assert ('application/marcxml+xml' == ContentNegotiator.match_by_accept(server_mimetypes, client_mimetypes))
def test_choose_provided_and_accepted_mimetype():
    server_mimetypes = ['application/json', 'application/marcxml+xml']
    client_mimetypes = parse_accept_header('text/plain,application/json,*/*', MIMEAccept)
    assert ('application/json' == ContentNegotiator.match_by_accept(server_mimetypes, client_mimetypes))
    client_mimetypes = parse_accept_header('text/plain,application/marcxml+xml,*/*', MIMEAccept)
    assert ('application/marcxml+xml' == ContentNegotiator.match_by_accept(server_mimetypes, client_mimetypes))