def test_get_unsupported_encoder_with_fallback(): codec = negotiate_encoder(accept='application/csv, */*') assert isinstance(codec, CoreJSONCodec)
def test_get_unsupported_encoder(): with pytest.raises(NotAcceptable): negotiate_encoder('application/csv')
def test_get_underspecified_encoder(): codec = negotiate_encoder(accept='text/*') assert isinstance(codec, CoreHTMLCodec)
def test_get_accepted_encoder(): codec = negotiate_encoder(accept='application/vnd.coreapi+json') assert isinstance(codec, CoreJSONCodec)
def test_encoder_preference(): codec = negotiate_encoder( accept='text/html; q=1.0, application/vnd.coreapi+json; q=1.0' ) assert isinstance(codec, CoreJSONCodec)
def test_get_default_encoder(): codec = negotiate_encoder() assert isinstance(codec, CoreJSONCodec)