1 # Copyright 2011 OpenStack Foundation.
4 # Licensed under the Apache License, Version 2.0 (the "License"); you may
5 # not use this file except in compliance with the License. You may obtain
6 # a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 # License for the specific language governing permissions and limitations
18 from neutron.api import extensions
19 from neutron import wsgi
22 class StubExtension(extensions.ExtensionDescriptor):
24 def __init__(self, alias="stub_extension"):
28 return "Stub Extension"
33 def get_description(self):
36 def get_updated(self):
40 class StubPlugin(object):
42 def __init__(self, supported_extensions=None):
43 supported_extensions = supported_extensions or []
44 self.supported_extension_aliases = supported_extensions
47 class ExtensionExpectingPluginInterface(StubExtension):
48 """Expect plugin to implement all methods in StubPluginInterface.
50 This extension expects plugin to implement all the methods defined
51 in StubPluginInterface.
54 def get_plugin_interface(self):
55 return StubPluginInterface
58 class StubPluginInterface(extensions.PluginInterface):
61 def get_foo(self, bar=None):
65 class StubBaseAppController(wsgi.Controller):
67 def index(self, request):
68 return "base app index"
70 def show(self, request, id):
71 return {'fort': 'knox'}
73 def update(self, request, id):
74 return {'uneditable': 'original_value'}