Ejemplo n.º 1
0
 def test_bad_import(self):
     settings = APISettings({'DEFAULT_PARSERS': 'foobarz.FailedImport'})
     with self.assertRaises(ImportError) as context:
         settings.DEFAULT_PARSERS
     msg = str(context.exception)
     excepted_py2 = (
         "Could not import 'foobarz.FailedImport' for API setting "
         "'DEFAULT_PARSERS'. No module named foobarz.")
     excepted_py3 = (
         "Could not import 'foobarz.FailedImport' for API setting "
         "'DEFAULT_PARSERS'. No module named 'foobarz'.")
     self.assertIn(msg, (excepted_py2, excepted_py3))
Ejemplo n.º 2
0
 def test_bad_import(self):
     settings = APISettings({'DEFAULT_PARSERS': 'foobarz.FailedImport'})
     with pytest.raises(ImportError) as exception:
         settings.DEFAULT_PARSERS
     msg = str(exception.value)
     excepted_py2 = (
         "Could not import 'foobarz.FailedImport' for API setting "
         "'DEFAULT_PARSERS'. No module named foobarz."
     )
     excepted_py3 = (
         "Could not import 'foobarz.FailedImport' for API setting "
         "'DEFAULT_PARSERS'. No module named 'foobarz'."
     )
     assert msg in (excepted_py2, excepted_py3)
Ejemplo n.º 3
0
 def __init__(self, *args, **kwargs):
     super(FlaskAPI, self).__init__(*args, **kwargs)
     self.api_settings = APISettings(self.config)
     self.register_blueprint(api_resources)
     self.jinja_env.filters['urlize_quoted_links'] = urlize_quoted_links