Fix test cases still use v3 prefix

After commit e03cfed720
the prefix of v3 API was changed to os_compute_api
so prefix in test cases should be changed as well.
This patch changed test_cells, test_extended_volumes,
test_simple_tenant_usage and test_used_limits.

Partially implements bp v3-api-policy

Change-Id: I793f6bbb35ab868d05224e4076befe981b19d537
This commit is contained in:
jichenjc 2015-03-20 03:53:53 +08:00
parent 37a6c601f3
commit d22673d38f
4 changed files with 14 additions and 7 deletions

View File

@ -88,7 +88,7 @@ class BaseCellsTest(test.NoDBTestCase):
class CellsTestV21(BaseCellsTest):
cell_extension = 'compute_extension:v3:os-cells'
cell_extension = 'os_compute_api:os-cells'
bad_request = exception.ValidationError
def _get_cell_controller(self, ext_mgr):

View File

@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from oslo_serialization import jsonutils
import webob
@ -150,14 +151,20 @@ class ExtendedVolumesEnforcementV21(test.NoDBTestCase):
self.controller = extended_volumes_v21.ExtendedVolumesController()
self.req = fakes.HTTPRequest.blank('')
def test_extend_show_policy_failed(self):
rule_name = 'compute_extension:v3:os-extended-volumes'
@mock.patch.object(extended_volumes_v21.ExtendedVolumesController,
'_extend_server')
def test_extend_show_policy_failed(self, mock_extend):
rule_name = 'os_compute_api:os-extended-volumes'
self.policy.set_rules({rule_name: "project:non_fake"})
# Pass ResponseObj as None, the code shouldn't touch the None.
self.controller.show(self.req, None, fakes.FAKE_UUID)
self.assertFalse(mock_extend.called)
def test_extend_detail_policy_failed(self):
rule_name = 'compute_extension:v3:os-extended-volumes'
@mock.patch.object(extended_volumes_v21.ExtendedVolumesController,
'_extend_server')
def test_extend_detail_policy_failed(self, mock_extend):
rule_name = 'os_compute_api:os-extended-volumes'
self.policy.set_rules({rule_name: "project:non_fake"})
# Pass ResponseObj as None, the code shouldn't touch the None.
self.controller.detail(self.req, None)
self.assertFalse(mock_extend.called)

View File

@ -104,7 +104,7 @@ def fake_instance_get_active_by_window_joined(context, begin, end,
@mock.patch.object(db, 'instance_get_active_by_window_joined',
fake_instance_get_active_by_window_joined)
class SimpleTenantUsageTestV21(test.TestCase):
policy_rule_prefix = "compute_extension:v3:os-simple-tenant-usage"
policy_rule_prefix = "os_compute_api:os-simple-tenant-usage"
controller = simple_tenant_usage_v21.SimpleTenantUsageController()
def setUp(self):

View File

@ -32,7 +32,7 @@ class FakeRequest(object):
class UsedLimitsTestCaseV21(test.NoDBTestCase):
used_limit_extension = "compute_extension:v3:os-used-limits:used_limits"
used_limit_extension = "os_compute_api:os-used-limits"
include_server_group_quotas = True
def setUp(self):