~ubuntu-branches/ubuntu/raring/nova/raring-proposed

« back to all changes in this revision

Viewing changes to nova/tests/api/openstack/volume/extensions/foxinsocks.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Adam Gandelman, Chuck Short
  • Date: 2012-11-23 09:04:58 UTC
  • mfrom: (1.1.66)
  • Revision ID: package-import@ubuntu.com-20121123090458-91565o7aev1i1h71
Tags: 2013.1~g1-0ubuntu1
[ Adam Gandelman ]
* debian/control: Ensure novaclient is upgraded with nova,
  require python-keystoneclient >= 1:2.9.0. (LP: #1073289)
* debian/patches/{ubuntu/*, rbd-security.patch}: Dropped, applied
  upstream.
* debian/control: Add python-testtools to Build-Depends.

[ Chuck Short ]
* New upstream version.
* Refreshed debian/patches/avoid_setuptools_git_dependency.patch.
* debian/rules: FTBFS if missing binaries.
* debian/nova-scheudler.install: Add missing rabbit-queues and
  nova-rpc-zmq-receiver.
* Remove nova-volume since it doesnt exist anymore, transition to cinder-*.
* debian/rules: install apport hook in the right place.
* debian/patches/ubuntu-show-tests.patch: Display test failures.
* debian/control: Add depends on genisoimage
* debian/control: Suggest guestmount.
* debian/control: Suggest websockify. (LP: #1076442)
* debian/nova.conf: Disable nova-volume service.
* debian/control: Depend on xen-system-* rather than the hypervisor.
* debian/control, debian/mans/nova-conductor.8, debian/nova-conductor.init,
  debian/nova-conductor.install, debian/nova-conductor.logrotate
  debian/nova-conductor.manpages, debian/nova-conductor.postrm
  debian/nova-conductor.upstart.in: Add nova-conductor service.
* debian/control: Add python-fixtures as a build deps.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
 
 
3
 
# Copyright 2011 OpenStack LLC.
4
 
# All Rights Reserved.
5
 
#
6
 
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
7
 
#    not use this file except in compliance with the License. You may obtain
8
 
#    a copy of the License at
9
 
#
10
 
#         http://www.apache.org/licenses/LICENSE-2.0
11
 
#
12
 
#    Unless required by applicable law or agreed to in writing, software
13
 
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14
 
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15
 
#    License for the specific language governing permissions and limitations
16
 
#    under the License.
17
 
 
18
 
import webob.exc
19
 
 
20
 
from nova.api.openstack import extensions
21
 
from nova.api.openstack import wsgi
22
 
 
23
 
 
24
 
class FoxInSocksController(object):
25
 
 
26
 
    def index(self, req):
27
 
        return "Try to say this Mr. Knox, sir..."
28
 
 
29
 
 
30
 
class FoxInSocksServerControllerExtension(wsgi.Controller):
31
 
    @wsgi.action('add_tweedle')
32
 
    def _add_tweedle(self, req, id, body):
33
 
 
34
 
        return "Tweedle Beetle Added."
35
 
 
36
 
    @wsgi.action('delete_tweedle')
37
 
    def _delete_tweedle(self, req, id, body):
38
 
 
39
 
        return "Tweedle Beetle Deleted."
40
 
 
41
 
    @wsgi.action('fail')
42
 
    def _fail(self, req, id, body):
43
 
 
44
 
        raise webob.exc.HTTPBadRequest(explanation='Tweedle fail')
45
 
 
46
 
 
47
 
class FoxInSocksFlavorGooseControllerExtension(wsgi.Controller):
48
 
    @wsgi.extends
49
 
    def show(self, req, resp_obj, id):
50
 
        #NOTE: This only handles JSON responses.
51
 
        # You can use content type header to test for XML.
52
 
        resp_obj.obj['flavor']['googoose'] = req.GET.get('chewing')
53
 
 
54
 
 
55
 
class FoxInSocksFlavorBandsControllerExtension(wsgi.Controller):
56
 
    @wsgi.extends
57
 
    def show(self, req, resp_obj, id):
58
 
        #NOTE: This only handles JSON responses.
59
 
        # You can use content type header to test for XML.
60
 
        resp_obj.obj['big_bands'] = 'Pig Bands!'
61
 
 
62
 
 
63
 
class Foxinsocks(extensions.ExtensionDescriptor):
64
 
    """The Fox In Socks Extension"""
65
 
 
66
 
    name = "Fox In Socks"
67
 
    alias = "FOXNSOX"
68
 
    namespace = "http://www.fox.in.socks/api/ext/pie/v1.0"
69
 
    updated = "2011-01-22T13:25:27-06:00"
70
 
 
71
 
    def __init__(self, ext_mgr):
72
 
        ext_mgr.register(self)
73
 
 
74
 
    def get_resources(self):
75
 
        resources = []
76
 
        resource = extensions.ResourceExtension('foxnsocks',
77
 
                                               FoxInSocksController())
78
 
        resources.append(resource)
79
 
        return resources
80
 
 
81
 
    def get_controller_extensions(self):
82
 
        extension_list = []
83
 
 
84
 
        extension_set = [
85
 
            (FoxInSocksServerControllerExtension, 'servers'),
86
 
            (FoxInSocksFlavorGooseControllerExtension, 'flavors'),
87
 
            (FoxInSocksFlavorBandsControllerExtension, 'flavors'),
88
 
            ]
89
 
        for klass, collection in extension_set:
90
 
            controller = klass()
91
 
            ext = extensions.ControllerExtension(self, collection, controller)
92
 
            extension_list.append(ext)
93
 
 
94
 
        return extension_list