Skip to content

Commit

Permalink
Rename IBlueprint example extension.
Browse files Browse the repository at this point in the history
Rename example_flask_iroutes --> example_flask_blueprint.
  • Loading branch information
brew committed Jun 3, 2016
1 parent 756157f commit ff97412
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 9 deletions.
6 changes: 5 additions & 1 deletion ckan/tests/config/test_middleware.py
Expand Up @@ -317,7 +317,7 @@ def test_ask_around_pylons_extension_route_get_after_map(self):
def test_ask_around_flask_core_and_pylons_extension_route(self):

# TODO: re-enable when we have a way for Flask extensions to add routes
raise nose.SkipTest()
# raise nose.SkipTest()

if not p.plugin_loaded('test_routing_plugin'):
p.load('test_routing_plugin')
Expand Down Expand Up @@ -407,6 +407,7 @@ def test_flask_core_and_pylons_core_route_is_served_by_flask(self):
class MockRoutingPlugin(p.SingletonPlugin):

p.implements(p.IRoutes)
p.implements(p.IBlueprint)

controller = 'ckan.tests.config.test_middleware:MockPylonsController'

Expand All @@ -431,6 +432,9 @@ def after_map(self, _map):

return _map

def get_blueprint(self):
pass


class MockPylonsController(p.toolkit.BaseController):

Expand Down
File renamed without changes.
Expand Up @@ -69,11 +69,12 @@ def helper_here():
return render_template_string(html)


class ExampleFlaskIRoutesPlugin(p.SingletonPlugin):
class ExampleFlaskIBlueprintPlugin(p.SingletonPlugin):
'''
An example IRoutes plugin to demonstrate Flask routing from an extension.
An example IBlueprint plugin to demonstrate Flask routing from an
extension.
'''
p.implements(p.IRoutes, inherit=True)
p.implements(p.IBlueprint, inherit=True)

def get_blueprint(self):
'''Return a Flask Blueprint object to be registered by the app.'''
Expand Down
Expand Up @@ -4,16 +4,16 @@
import ckan.tests.helpers as helpers


class TestFlaskIRoutes(helpers.FunctionalTestBase):
class TestFlaskIBlueprint(helpers.FunctionalTestBase):

def setup(self):
self.app = helpers._get_test_app()
flask_app = helpers.find_flask_app(self.app)

# Install plugin and register its blueprint
if not plugins.plugin_loaded('example_flask_iroutes'):
plugins.load('example_flask_iroutes')
plugin = plugins.get_plugin('example_flask_iroutes')
if not plugins.plugin_loaded('example_flask_iblueprint'):
plugins.load('example_flask_iblueprint')
plugin = plugins.get_plugin('example_flask_iblueprint')
flask_app.register_blueprint(plugin.get_blueprint(),
prioritise_rules=True)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -140,7 +140,7 @@
'example_itranslation = ckanext.example_itranslation.plugin:ExampleITranslationPlugin',
'example_iconfigurer_v1 = ckanext.example_iconfigurer.plugin_v1:ExampleIConfigurerPlugin',
'example_iconfigurer_v2 = ckanext.example_iconfigurer.plugin_v2:ExampleIConfigurerPlugin',
'example_flask_iroutes = ckanext.example_flask_iroutes.plugin:ExampleFlaskIRoutesPlugin',
'example_flask_iblueprint = ckanext.example_flask_iblueprint.plugin:ExampleFlaskIBlueprintPlugin',
'example_iuploader = ckanext.example_iuploader.plugin:ExampleIUploader',
],
'ckan.system_plugins': [
Expand Down

0 comments on commit ff97412

Please sign in to comment.