示例#1
0
class FlavorManageTestV2(FlavorManageTestV21):
    controller = flavormanage_v2.FlavorManageController()
    validation_error = webob.exc.HTTPBadRequest

    def setUp(self):
        super(FlavorManageTestV2, self).setUp()
        self.flags(osapi_compute_extension=[
            'nova.api.openstack.compute.contrib.select_extensions'
        ],
                   osapi_compute_ext_list=[
                       'Flavormanage', 'Flavorextradata', 'Flavor_access',
                       'Flavor_rxtx', 'Flavor_swap'
                   ])

    def _setup_app(self):
        return fakes.wsgi_app(
            init_only=('flavors', ),
            fake_auth_context=self._get_http_request().environ['nova.context'])

    def _get_http_request(self, url=''):
        return fakes.HTTPRequest.blank(url, use_admin_context=False)

    def test_create_with_name_leading_trailing_spaces(self):
        req = self._get_http_request(url=self.base_url)
        self.request_body['flavor']['name'] = '  test  '
        body = self._create_flavor_success_case(self.request_body, req)
        self.assertEqual('test', body['flavor']['name'])

    def test_create_with_name_leading_trailing_spaces_compat_mode(self):
        pass
示例#2
0
class FlavorManageTestV2(FlavorManageTestV21):
    controller = flavormanage_v2.FlavorManageController()
    validation_error = webob.exc.HTTPBadRequest

    def setUp(self):
        super(FlavorManageTestV2, self).setUp()
        self.flags(osapi_compute_extension=[
            'nova.api.openstack.compute.contrib.select_extensions'
        ],
                   osapi_compute_ext_list=[
                       'Flavormanage', 'Flavorextradata', 'Flavor_access',
                       'Flavor_rxtx', 'Flavor_swap'
                   ])

    def _setup_app(self):
        return fakes.wsgi_app(
            init_only=('flavors', ),
            fake_auth_context=self._get_http_request().environ['nova.context'])

    def _get_http_request(self, url=''):
        return fakes.HTTPRequest.blank(url, use_admin_context=False)