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

« back to all changes in this revision

Viewing changes to nova/tests/api/openstack/volume/test_router.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
 
# Copyright 2011 Denali Systems, Inc.
2
 
# All Rights Reserved.
3
 
#
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
7
 
#
8
 
#         http://www.apache.org/licenses/LICENSE-2.0
9
 
#
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
14
 
#    under the License.
15
 
 
16
 
 
17
 
from nova.api.openstack import volume
18
 
from nova.api.openstack.volume import snapshots
19
 
from nova.api.openstack.volume import versions
20
 
from nova.api.openstack.volume import volumes
21
 
from nova.api.openstack import wsgi
22
 
from nova import flags
23
 
from nova.openstack.common import log as logging
24
 
from nova import test
25
 
from nova.tests.api.openstack import fakes
26
 
 
27
 
FLAGS = flags.FLAGS
28
 
 
29
 
LOG = logging.getLogger(__name__)
30
 
 
31
 
 
32
 
class FakeController(object):
33
 
    def __init__(self, ext_mgr=None):
34
 
        self.ext_mgr = ext_mgr
35
 
 
36
 
    def index(self, req):
37
 
        return {}
38
 
 
39
 
    def detail(self, req):
40
 
        return {}
41
 
 
42
 
 
43
 
def create_resource(ext_mgr):
44
 
    return wsgi.Resource(FakeController(ext_mgr))
45
 
 
46
 
 
47
 
def create_volume_resource(ext_mgr):
48
 
    return wsgi.Resource(FakeController(ext_mgr))
49
 
 
50
 
 
51
 
class VolumeRouterTestCase(test.TestCase):
52
 
    def setUp(self):
53
 
        super(VolumeRouterTestCase, self).setUp()
54
 
        # NOTE(vish): versions is just returning text so, no need to stub.
55
 
        self.stubs.Set(snapshots, 'create_resource', create_resource)
56
 
        self.stubs.Set(volumes, 'create_resource', create_volume_resource)
57
 
        self.app = volume.APIRouter()
58
 
 
59
 
    def test_versions(self):
60
 
        req = fakes.HTTPRequest.blank('')
61
 
        req.method = 'GET'
62
 
        req.content_type = 'application/json'
63
 
        response = req.get_response(self.app)
64
 
        self.assertEqual(302, response.status_int)
65
 
        req = fakes.HTTPRequest.blank('/')
66
 
        req.method = 'GET'
67
 
        req.content_type = 'application/json'
68
 
        response = req.get_response(self.app)
69
 
        self.assertEqual(200, response.status_int)
70
 
 
71
 
    def test_versions_dispatch(self):
72
 
        req = fakes.HTTPRequest.blank('/')
73
 
        req.method = 'GET'
74
 
        req.content_type = 'application/json'
75
 
        resource = versions.Versions()
76
 
        result = resource.dispatch(resource.index, req, {})
77
 
        self.assertTrue(result)
78
 
 
79
 
    def test_volumes(self):
80
 
        req = fakes.HTTPRequest.blank('/fake/volumes')
81
 
        req.method = 'GET'
82
 
        req.content_type = 'application/json'
83
 
        response = req.get_response(self.app)
84
 
        self.assertEqual(200, response.status_int)
85
 
 
86
 
    def test_volumes_detail(self):
87
 
        req = fakes.HTTPRequest.blank('/fake/volumes/detail')
88
 
        req.method = 'GET'
89
 
        req.content_type = 'application/json'
90
 
        response = req.get_response(self.app)
91
 
        self.assertEqual(200, response.status_int)
92
 
 
93
 
    def test_types(self):
94
 
        req = fakes.HTTPRequest.blank('/fake/types')
95
 
        req.method = 'GET'
96
 
        req.content_type = 'application/json'
97
 
        response = req.get_response(self.app)
98
 
        self.assertEqual(200, response.status_int)
99
 
 
100
 
    def test_snapshots(self):
101
 
        req = fakes.HTTPRequest.blank('/fake/snapshots')
102
 
        req.method = 'GET'
103
 
        req.content_type = 'application/json'
104
 
        response = req.get_response(self.app)
105
 
        self.assertEqual(200, response.status_int)
106
 
 
107
 
    def test_snapshots_detail(self):
108
 
        req = fakes.HTTPRequest.blank('/fake/snapshots/detail')
109
 
        req.method = 'GET'
110
 
        req.content_type = 'application/json'
111
 
        response = req.get_response(self.app)
112
 
        self.assertEqual(200, response.status_int)